this._cancelledRetries = 0;
let reauthenticationOnly;
- if (this._mode == AuthPromptMode.UNLOCK_ONLY)
+ if (this._mode === AuthPromptMode.UNLOCK_ONLY)
reauthenticationOnly = true;
- else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN)
+ else if (this._mode === AuthPromptMode.UNLOCK_OR_LOG_IN)
reauthenticationOnly = false;
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, {reauthenticationOnly});
}
_onCredentialManagerAuthenticated() {
- if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
+ if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset();
}
// 2) Don't reset if we've already succeeded at verification and
// the user is getting logged in.
if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
- this.verificationStatus == AuthPromptStatus.VERIFYING &&
+ this.verificationStatus === AuthPromptStatus.VERIFYING &&
this.smartcardDetected)
return;
- if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
+ if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset();
}
oldActor.remove_all_transitions();
let wasSpinner;
- if (oldActor == this._spinner)
+ if (oldActor === this._spinner)
wasSpinner = true;
else
wasSpinner = false;
let isSpinner;
- if (actor == this._spinner)
+ if (actor === this._spinner)
isSpinner = true;
else
isSpinner = false;
- if (this._defaultButtonWellActor != actor && oldActor) {
+ if (this._defaultButtonWellActor !== actor && oldActor) {
if (!animate) {
oldActor.opacity = 0;
}
_fadeOutMessage() {
- if (this._message.opacity == 0)
+ if (this._message.opacity === 0)
return;
this._message.remove_all_transitions();
this._message.ease({
}
setMessage(message, type, wiggleParameters = {duration: 0}) {
- if (type == GdmUtil.MessageType.ERROR)
+ if (type === GdmUtil.MessageType.ERROR)
this._message.add_style_class_name('login-dialog-message-warning');
else
this._message.remove_style_class_name('login-dialog-message-warning');
- if (type == GdmUtil.MessageType.HINT)
+ if (type === GdmUtil.MessageType.HINT)
this._message.add_style_class_name('login-dialog-message-hint');
else
this._message.remove_style_class_name('login-dialog-message-hint');
this._updateEntry(true);
this.stopSpinning();
- if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
+ if (oldStatus === AuthPromptStatus.VERIFICATION_FAILED)
this.emit('failed');
else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
this.emit('cancelled');
let beginRequestType;
- if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
+ if (this._mode === AuthPromptMode.UNLOCK_ONLY) {
// The user is constant at the unlock screen, so it will immediately
// respond to the request with the username
if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
}
cancel() {
- if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
+ if (this.verificationStatus === AuthPromptStatus.VERIFICATION_SUCCEEDED)
return;
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_IN_PROGRESS) {
release() {
this._acquisitions--;
- if (this._acquisitions == 0)
+ if (this._acquisitions === 0)
this.emit('release');
}
if (!hasItems)
return;
- if (global.stage.get_key_focus() != this)
+ if (global.stage.get_key_focus() !== this)
return;
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
_updateOrnament() {
let itemIds = Object.keys(this._items);
for (let i = 0; i < itemIds.length; i++) {
- if (itemIds[i] == this._activeSessionId)
+ if (itemIds[i] === this._activeSessionId)
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.DOT);
else
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.NONE);
}
setActiveSession(sessionId) {
- if (sessionId == this._activeSessionId)
+ if (sessionId === this._activeSessionId)
return;
this._activeSessionId = sessionId;
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
// Disable user list when there are no users.
- if (this._userListLoaded && this._userList.numItems() == 0)
+ if (this._userListLoaded && this._userList.numItems() === 0)
disableUserList = true;
- if (disableUserList != this._disableUserList) {
+ if (disableUserList !== this._disableUserList) {
this._disableUserList = disableUserList;
- if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
+ if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
this._authPrompt.reset();
if (this._disableUserList && this._timedLoginUserListHold)
// Hide the cancel button if the user list is disabled and we're asking for
// a username
- if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING && this._disableUserList)
+ if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING &&
+ this._disableUserList)
cancelVisible = false;
else
cancelVisible = true;
}
_resetGreeterProxy() {
- if (GLib.getenv('GDM_GREETER_TEST') != '1') {
+ if (GLib.getenv('GDM_GREETER_TEST') !== '1') {
if (this._greeter)
this._greeter.run_dispose();
}
_shouldShowSessionMenuButton() {
- if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING &&
- this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
+ if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFYING &&
+ this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
return false;
if (this._user && this._user.is_loaded && this._user.is_logged_in())
_bindOpacity() {
this._bindings = Main.layoutManager.uiGroup.get_children()
- .filter(c => c != Main.layoutManager.screenShieldGroup)
+ .filter(c => c !== Main.layoutManager.screenShieldGroup)
.map(c => this.bind_property('opacity', c, 'opacity', 0));
}
}
_loginScreenSessionActivated() {
- if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
+ if (this.opacity === 255 &&
+ this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
return;
if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
// Restart timed login on user interaction
global.stage.connect('captured-event', (actor, event) => {
- if (event.type() == Clutter.EventType.KEY_PRESS ||
- event.type() == Clutter.EventType.BUTTON_PRESS)
+ if (event.type() === Clutter.EventType.KEY_PRESS ||
+ event.type() === Clutter.EventType.BUTTON_PRESS)
this._startTimedLogin(userName, seconds);
return Clutter.EVENT_PROPAGATE;
}
}
- if (this._loginFormat != newLoginFormat) {
+ if (this._loginFormat !== newLoginFormat) {
this._loginFormat = newLoginFormat;
this.emit('login-format-changed', newLoginFormat);
}
}
_queueMessageTimeout() {
- if (this._messageQueueTimeoutId != 0)
+ if (this._messageQueueTimeoutId !== 0)
return;
const message = this.currentMessage;
_clearMessageQueue() {
this.finishMessageQueue();
- if (this._messageQueueTimeoutId != 0) {
+ if (this._messageQueueTimeoutId !== 0) {
GLib.source_remove(this._messageQueueTimeoutId);
this._messageQueueTimeoutId = 0;
}
else
smartcardDetected = this._smartcardManager.hasInsertedTokens();
- if (smartcardDetected != this.smartcardDetected) {
+ if (smartcardDetected !== this.smartcardDetected) {
this.smartcardDetected = smartcardDetected;
if (this.smartcardDetected)
this._preemptingService = SMARTCARD_SERVICE_NAME;
- else if (this._preemptingService == SMARTCARD_SERVICE_NAME)
+ else if (this._preemptingService === SMARTCARD_SERVICE_NAME)
this._preemptingService = null;
this.emit('smartcard-status-changed');
}
serviceIsDefault(serviceName) {
- return serviceName == this._defaultService;
+ return serviceName === this._defaultService;
}
serviceIsFingerprint(serviceName) {
while ((info = children.next_file(null)) != null) {
let type = info.get_file_type();
let child = dir.get_child(info.get_name());
- if (type == Gio.FileType.REGULAR)
+ if (type === Gio.FileType.REGULAR)
child.delete(null);
- else if (type == Gio.FileType.DIRECTORY)
+ else if (type === Gio.FileType.DIRECTORY)
recursivelyDeleteDir(child, true);
}
let type = info.get_file_type();
let srcChild = srcDir.get_child(info.get_name());
let destChild = destDir.get_child(info.get_name());
- if (type == Gio.FileType.REGULAR)
+ if (type === Gio.FileType.REGULAR)
srcChild.move(destChild, Gio.FileCopyFlags.NONE, null, null);
- else if (type == Gio.FileType.DIRECTORY)
+ else if (type === Gio.FileType.DIRECTORY)
recursivelyMoveDir(srcChild, destChild);
}
}
function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) {
if ((IBus.MAJOR_VERSION > requiredMajor) ||
- (IBus.MAJOR_VERSION == requiredMajor && IBus.MINOR_VERSION > requiredMinor) ||
- (IBus.MAJOR_VERSION == requiredMajor && IBus.MINOR_VERSION == requiredMinor &&
+ (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION > requiredMinor) ||
+ (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION === requiredMinor &&
IBus.MICRO_VERSION >= requiredMicro))
return;
this._currentEngineName = engineName;
this._candidatePopup.close(BoxPointer.PopupAnimation.NONE);
- if (this._registerPropertiesId != 0)
+ if (this._registerPropertiesId !== 0)
return;
this._registerPropertiesId =
if (!ids.includes(TYPING_BOOSTER_ENGINE))
ids.push(TYPING_BOOSTER_ENGINE);
- if (this._preloadEnginesId != 0) {
+ if (this._preloadEnginesId !== 0) {
GLib.source_remove(this._preloadEnginesId);
this._preloadEnginesId = 0;
}
}
_onForwardKeyEvent(_context, keyval, keycode, state) {
- let press = (state & IBus.ModifierType.RELEASE_MASK) == 0;
+ let press = (state & IBus.ModifierType.RELEASE_MASK) === 0;
state &= ~IBus.ModifierType.RELEASE_MASK;
let curEvent = Clutter.get_current_event();
vfunc_update_content_purpose(purpose) {
let ibusPurpose = 0;
- if (purpose == Clutter.InputContentPurpose.NORMAL)
+ if (purpose === Clutter.InputContentPurpose.NORMAL)
ibusPurpose = IBus.InputPurpose.FREE_FORM;
- else if (purpose == Clutter.InputContentPurpose.ALPHA)
+ else if (purpose === Clutter.InputContentPurpose.ALPHA)
ibusPurpose = IBus.InputPurpose.ALPHA;
- else if (purpose == Clutter.InputContentPurpose.DIGITS)
+ else if (purpose === Clutter.InputContentPurpose.DIGITS)
ibusPurpose = IBus.InputPurpose.DIGITS;
- else if (purpose == Clutter.InputContentPurpose.NUMBER)
+ else if (purpose === Clutter.InputContentPurpose.NUMBER)
ibusPurpose = IBus.InputPurpose.NUMBER;
- else if (purpose == Clutter.InputContentPurpose.PHONE)
+ else if (purpose === Clutter.InputContentPurpose.PHONE)
ibusPurpose = IBus.InputPurpose.PHONE;
- else if (purpose == Clutter.InputContentPurpose.URL)
+ else if (purpose === Clutter.InputContentPurpose.URL)
ibusPurpose = IBus.InputPurpose.URL;
- else if (purpose == Clutter.InputContentPurpose.EMAIL)
+ else if (purpose === Clutter.InputContentPurpose.EMAIL)
ibusPurpose = IBus.InputPurpose.EMAIL;
- else if (purpose == Clutter.InputContentPurpose.NAME)
+ else if (purpose === Clutter.InputContentPurpose.NAME)
ibusPurpose = IBus.InputPurpose.NAME;
- else if (purpose == Clutter.InputContentPurpose.PASSWORD)
+ else if (purpose === Clutter.InputContentPurpose.PASSWORD)
ibusPurpose = IBus.InputPurpose.PASSWORD;
else if (purpose === Clutter.InputContentPurpose.TERMINAL &&
IBus.InputPurpose.TERMINAL)
if (state & IBus.ModifierType.IGNORED_MASK)
return false;
- if (event.type() == Clutter.EventType.KEY_RELEASE)
+ if (event.type() === Clutter.EventType.KEY_RELEASE)
state |= IBus.ModifierType.RELEASE_MASK;
this._context.process_key_event_async(
event.get_key_code() - 8, // Convert XKB keycodes to evcodes
state, -1, this._cancellable,
(context, res) => {
- if (context != this._context)
+ if (context !== this._context)
return;
try {
for (let app of apps) {
let appInfo = {};
- let isAppActive = focusedApp == app;
+ let isAppActive = focusedApp === app;
if (!this._isStandaloneApp(app))
continue;
if (this._runningApplicationsDirty ||
(this._activeApplicationDirty &&
- this._activeApplication != newActiveApplication)) {
+ this._activeApplication !== newActiveApplication)) {
this._runningApplications = newRunningApplications;
this._activeApplication = newActiveApplication;
return false;
let type = window.get_window_type();
- return type == Meta.WindowType.NORMAL ||
- type == Meta.WindowType.DIALOG ||
- type == Meta.WindowType.MODAL_DIALOG ||
- type == Meta.WindowType.UTILITY;
+ return type === Meta.WindowType.NORMAL ||
+ type === Meta.WindowType.DIALOG ||
+ type === Meta.WindowType.MODAL_DIALOG ||
+ type === Meta.WindowType.UTILITY;
}
async GetRunningApplicationsAsync(params, invocation) {
'app-id': GLib.Variant.new('s', app.get_id()),
'client-type': GLib.Variant.new('u', window.get_client_type()),
'is-hidden': GLib.Variant.new('b', window.is_hidden()),
- 'has-focus': GLib.Variant.new('b', window == focusWindow),
+ 'has-focus': GLib.Variant.new('b', window === focusWindow),
'width': GLib.Variant.new('u', frameRect.width),
'height': GLib.Variant.new('u', frameRect.height),
};
// Look for the empty expression or partially entered words
// not proceeded by a dot and match them against global constants
matches = text.match(/^(\w*)$/);
- if (text == '' || matches) {
+ if (text === '' || matches) {
[expr_, attrHead] = matches;
methods = globalCompletionList.filter(
attr => attr.slice(0, attrHead.length) === attrHead);
export function findMatchingQuote(expr, offset) {
let quoteChar = expr.charAt(offset);
for (let i = offset - 1; i >= 0; --i) {
- if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\')
+ if (expr.charAt(i) === quoteChar && expr.charAt(i - 1) !== '\\')
return i;
}
return -1;
*/
export function findMatchingSlash(expr, offset) {
for (let i = offset - 1; i >= 0; --i) {
- if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\')
+ if (expr.charAt(i) === '/' && expr.charAt(i - 1) !== '\\')
return i;
}
return -1;
if (offset < 0)
return -1;
- if (expr.charAt(offset) == openBrace)
+ if (expr.charAt(offset) === openBrace)
return offset;
if (expr.charAt(offset).match(/['"]/))
return findTheBrace(expr, findMatchingQuote(expr, offset) - 1, ...braces);
- if (expr.charAt(offset) == '/')
+ if (expr.charAt(offset) === '/')
return findTheBrace(expr, findMatchingSlash(expr, offset) - 1, ...braces);
- if (expr.charAt(offset) == closeBrace)
+ if (expr.charAt(offset) === closeBrace)
return findTheBrace(expr, findTheBrace(expr, offset - 1, ...braces) - 1, ...braces);
return findTheBrace(expr, offset - 1, ...braces);
let word = words[0];
for (let i = 0; i < word.length; i++) {
for (let w = 1; w < words.length; w++) {
- if (words[w].charAt(i) != word.charAt(i))
+ if (words[w].charAt(i) !== word.charAt(i))
return word.slice(0, i);
}
}
* @param {string} str
*/
export function removeLiterals(str) {
- if (str.length == 0)
+ if (str.length === 0)
return '';
let currChar = str.charAt(str.length - 1);
- if (currChar == '"' || currChar == '\'') {
+ if (currChar === '"' || currChar === '\'') {
return removeLiterals(
str.slice(0, findMatchingQuote(str, str.length - 1)));
- } else if (currChar == '/') {
+ } else if (currChar === '/') {
return removeLiterals(
str.slice(0, findMatchingSlash(str, str.length - 1)));
}
let [layouts, variants] = this._buildGroupStrings(group);
if (this._currentKeymap &&
- this._currentKeymap.layouts == layouts &&
- this._currentKeymap.variants == variants &&
- this._currentKeymap.options == options)
+ this._currentKeymap.layouts === layouts &&
+ this._currentKeymap.variants === variants &&
+ this._currentKeymap.options === options)
return;
this._currentKeymap = {layouts, variants, options};
if (!info)
return;
- if (this._current && this._current.group == info.group) {
- if (this._current.groupIndex != info.groupIndex)
+ if (this._current && this._current.group === info.group) {
+ if (this._current.groupIndex !== info.groupIndex)
this._applyLayoutGroupIndex(info.groupIndex);
} else {
this._applyLayoutGroup(info.group);
// handle mnemonics like Alt+Ф even if the user is
// actually typing in a different layout.
let groupIndex = i % (this.MAX_LAYOUTS_PER_GROUP - 1);
- if (groupIndex == 0)
+ if (groupIndex === 0)
group = [];
let info = this._layoutInfos[id];
for (let i = 0; i < required.length; i++) {
let requiredInt = parseInt(required[i]);
let referenceInt = parseInt(reference[i]);
- if (requiredInt != referenceInt)
+ if (requiredInt !== referenceInt)
return requiredInt < referenceInt;
}
'org.freedesktop.login1',
objectPath);
log(`Considering ${session}, class=${sessionProxy.Class}`);
- if (sessionProxy.Class == 'greeter') {
+ if (sessionProxy.Class === 'greeter') {
log(`Yes, will monitor session ${session}`);
sessionId = session;
break;
//
function _findProviderForMccMnc(operatorName, operatorCode) {
if (operatorName) {
- if (operatorName.length != 0 &&
+ if (operatorName.length !== 0 &&
(operatorName.length > 6 || operatorName.length < 5)) {
// this looks like a valid name, i.e. not an MCCMNC (that some
// devices return when not yet connected
}
let needle;
- if ((!operatorName || operatorName.length == 0) && operatorCode)
+ if ((!operatorName || operatorName.length === 0) && operatorCode)
needle = operatorCode;
- else if (operatorName && (operatorName.length == 6 || operatorName.length == 5))
+ else if (operatorName && (operatorName.length === 6 || operatorName.length === 5))
needle = operatorName;
else // nothing to search
return null;
}
_setOperatorName(operatorName) {
- if (this._operatorName == operatorName)
+ if (this._operatorName === operatorName)
return;
this._operatorName = operatorName;
this.notify('operator-name');
}
_setSignalQuality(signalQuality) {
- if (this._signalQuality == signalQuality)
+ if (this._signalQuality === signalQuality)
return;
this._signalQuality = signalQuality;
this.notify('signal-quality');
newName += this.operator_name_3gpp;
if (this.operator_name_cdma && this.operator_name_cdma.length > 0) {
- if (newName != '')
+ if (newName !== '')
newName += ', ';
newName += this.operator_name_cdma;
}
this._addToken(tokens[i]);
this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => {
- if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
+ if (interfaceName === 'org.gnome.SettingsDaemon.Smartcard.Token')
this._addToken(proxy);
});
this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => {
- if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
+ if (interfaceName === 'org.gnome.SettingsDaemon.Smartcard.Token')
this._removeToken(proxy);
});
}
_removeToken(token) {
let objectPath = token.get_object_path();
- if (this._insertedTokens[objectPath] == token) {
+ if (this._insertedTokens[objectPath] === token) {
delete this._insertedTokens[objectPath];
this.emit('smartcard-removed', token);
}
- if (this._loginToken == token)
+ if (this._loginToken === token)
this._loginToken = null;
token.disconnectAll();
let min, max, mid, v;
cmp ||= (a, b) => a - b;
- if (array.length == 0)
+ if (array.length === 0)
return 0;
min = 0;
max = mid;
}
- return min == max || cmp(array[min], val) < 0 ? max : min;
+ return min === max || cmp(array[min], val) < 0 ? max : min;
}
/**
}
_locationsEqual(loc1, loc2) {
- if (loc1 == loc2)
+ if (loc1 === loc2)
return true;
if (loc1 == null || loc2 == null)
_updateLocationMonitoring() {
if (this._useAutoLocation) {
- if (this._gclueLocationChangedId != 0 || this._gclueService == null)
+ if (this._gclueLocationChangedId !== 0 || this._gclueService == null)
return;
this._gclueLocationChangedId =
_onAutomaticLocationChanged() {
let useAutoLocation = this._settings.get_boolean('automatic-location');
- if (this._autoLocationRequested == useAutoLocation)
+ if (this._autoLocationRequested === useAutoLocation)
return;
this._autoLocationRequested = useAutoLocation;
_onPermStoreChanged(proxy, sender, params) {
let [table, id, deleted_, data_, perms] = params;
- if (table != 'gnome' || id != 'geolocation')
+ if (table !== 'gnome' || id !== 'geolocation')
return;
let permission = perms['org.gnome.Weather'] || ['NONE'];
let [accuracy] = permission;
- this._weatherAuthorized = accuracy != 'NONE';
+ this._weatherAuthorized = accuracy !== 'NONE';
this._updateAutoLocation();
}
}
CloseAsync(invocation, _params) {
- if (this._invocation.get_sender() != invocation.get_sender()) {
+ if (this._invocation.get_sender() !== invocation.get_sender()) {
invocation.return_error_literal(
Gio.DBusError,
Gio.DBusError.ACCESS_DENIED,
this._requestExported = false;
let results = {};
- if (response == DialogResponse.OK) {
+ if (response === DialogResponse.OK) {
for (let [id, check] of this._choices) {
let checked = check.checked ? 'true' : 'false';
results[id] = new GLib.Variant('s', checked);
}
_initialSelection(backward, binding) {
- if (binding == 'switch-group') {
+ if (binding === 'switch-group') {
if (backward)
this._select(0, this._items[0].cachedWindows.length - 1);
else if (this._items[0].cachedWindows.length > 1)
this._select(0, 1);
else
this._select(0, 0);
- } else if (binding == 'switch-group-backward') {
+ } else if (binding === 'switch-group-backward') {
this._select(0, this._items[0].cachedWindows.length - 1);
- } else if (binding == 'switch-applications-backward') {
+ } else if (binding === 'switch-applications-backward') {
this._select(this._items.length - 1);
- } else if (this._items.length == 1) {
+ } else if (this._items.length === 1) {
this._select(0);
} else if (backward) {
this._select(this._items.length - 1);
_nextWindow() {
// We actually want the second window if we're in the unset state
- if (this._currentWindow == -1)
+ if (this._currentWindow === -1)
this._currentWindow = 0;
return SwitcherPopup.mod(
this._currentWindow + 1,
_previousWindow() {
// Also assume second window here
- if (this._currentWindow == -1)
+ if (this._currentWindow === -1)
this._currentWindow = 1;
return SwitcherPopup.mod(
this._currentWindow - 1,
_keyPressHandler(keysym, action) {
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
- if (action == Meta.KeyBindingAction.SWITCH_GROUP) {
+ if (action === Meta.KeyBindingAction.SWITCH_GROUP) {
if (!this._thumbnailsFocused)
this._select(this._selectedIndex, 0);
else
this._select(this._selectedIndex, this._nextWindow());
- } else if (action == Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD) {
+ } else if (action === Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD) {
this._select(this._selectedIndex, this._previousWindow());
- } else if (action == Meta.KeyBindingAction.SWITCH_APPLICATIONS) {
+ } else if (action === Meta.KeyBindingAction.SWITCH_APPLICATIONS) {
this._select(this._next());
- } else if (action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD) {
+ } else if (action === Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD) {
this._select(this._previous());
- } else if (keysym == Clutter.KEY_q || keysym === Clutter.KEY_Q) {
+ } else if (keysym === Clutter.KEY_q || keysym === Clutter.KEY_Q) {
this._quitApplication(this._selectedIndex);
} else if (this._thumbnailsFocused) {
if (keysym === Clutter.KEY_Left)
this._closeAppWindow(this._selectedIndex, this._currentWindow);
else
return Clutter.EVENT_PROPAGATE;
- } else if (keysym == Clutter.KEY_Left) {
+ } else if (keysym === Clutter.KEY_Left) {
this._select(rtl ? this._next() : this._previous());
- } else if (keysym == Clutter.KEY_Right) {
+ } else if (keysym === Clutter.KEY_Right) {
this._select(rtl ? this._previous() : this._next());
- } else if (keysym == Clutter.KEY_Down) {
+ } else if (keysym === Clutter.KEY_Down) {
this._select(this._selectedIndex, 0);
} else {
return Clutter.EVENT_PROPAGATE;
}
_scrollHandler(direction) {
- if (direction == Clutter.ScrollDirection.UP) {
+ if (direction === Clutter.ScrollDirection.UP) {
if (this._thumbnailsFocused) {
- if (this._currentWindow == 0 || this._currentWindow == -1)
+ if (this._currentWindow === 0 || this._currentWindow === -1)
this._select(this._previous());
else
this._select(this._selectedIndex, this._previousWindow());
else
this._select(this._previous());
}
- } else if (direction == Clutter.ScrollDirection.DOWN) {
+ } else if (direction === Clutter.ScrollDirection.DOWN) {
if (this._thumbnailsFocused) {
- if (this._currentWindow == this._items[this._selectedIndex].cachedWindows.length - 1)
+ if (this._currentWindow === this._items[this._selectedIndex].cachedWindows.length - 1)
this._select(this._next());
else
this._select(this._selectedIndex, this._nextWindow());
// If the user clicks on the selected app, activate the
// selected window; otherwise (eg, they click on an app while
// !mouseActive) activate the clicked-on app.
- if (n == this._selectedIndex && this._currentWindow >= 0)
+ if (n === this._selectedIndex && this._currentWindow >= 0)
this._select(n, this._currentWindow);
else
this._select(n);
}
_onDestroy() {
- if (this._thumbnailTimeoutId != 0)
+ if (this._thumbnailTimeoutId !== 0)
GLib.source_remove(this._thumbnailTimeoutId);
super._onDestroy();
* app list will have the keyboard focus.
*/
_select(app, window, forceAppFocus) {
- if (app != this._selectedIndex || window == null) {
+ if (app !== this._selectedIndex || window == null) {
if (this._thumbnails)
this._destroyThumbnails();
}
- if (this._thumbnailTimeoutId != 0) {
+ if (this._thumbnailTimeoutId !== 0) {
GLib.source_remove(this._thumbnailTimeoutId);
this._thumbnailTimeoutId = 0;
}
}
set window(w) {
- if (this._window == w)
+ if (this._window === w)
return;
this._window?.disconnectObject(this);
window.unminimize();
}
- if (activeWs == ws) {
+ if (activeWs === ws) {
Main.activateWindow(window);
} else {
// If the selected window is on a different workspace, we don't
}
_keyPressHandler(keysym, action) {
- if (action == Meta.KeyBindingAction.CYCLE_GROUP)
+ if (action === Meta.KeyBindingAction.CYCLE_GROUP)
this._select(this._next());
- else if (action == Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
+ else if (action === Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
this._select(this._previous());
else
return Clutter.EVENT_PROPAGATE;
_keyPressHandler(keysym, action) {
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
- if (action == Meta.KeyBindingAction.SWITCH_WINDOWS)
+ if (action === Meta.KeyBindingAction.SWITCH_WINDOWS)
this._select(this._next());
- else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD)
+ else if (action === Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Left)
+ else if (keysym === Clutter.KEY_Left)
this._select(rtl ? this._next() : this._previous());
- else if (keysym == Clutter.KEY_Right)
+ else if (keysym === Clutter.KEY_Right)
this._select(rtl ? this._previous() : this._next());
else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_W || keysym === Clutter.KEY_F4)
this._closeWindow(this._selectedIndex);
}
_keyPressHandler(keysym, action) {
- if (action == Meta.KeyBindingAction.CYCLE_WINDOWS)
+ if (action === Meta.KeyBindingAction.CYCLE_WINDOWS)
this._select(this._next());
- else if (action == Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
+ else if (action === Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
this._select(this._previous());
else
return Clutter.EVENT_PROPAGATE;
}
_onDestroy() {
- if (this._mouseTimeOutId != 0)
+ if (this._mouseTimeOutId !== 0)
GLib.source_remove(this._mouseTimeOutId);
this.icons.forEach(
_setIconSize() {
let j = 0;
- while (this._items.length > 1 && this._items[j].style_class != 'item-box')
+ while (this._items.length > 1 && this._items[j].style_class !== 'item-box')
j++;
let themeNode = this._items[j].get_theme_node();
let item = this.addItem(appIcon, appIcon.label);
appIcon.app.connectObject('notify::state', app => {
- if (app.state != Shell.AppState.RUNNING)
+ if (app.state !== Shell.AppState.RUNNING)
this._removeIcon(app);
}, this);
this.add_actor(arrow);
this._arrows.push(arrow);
- if (appIcon.cachedWindows.length == 1)
+ if (appIcon.cachedWindows.length === 1)
arrow.hide();
else
item.add_accessible_state(Atk.StateType.EXPANDABLE);
_removeIcon(app) {
let index = this.icons.findIndex(icon => {
- return icon.app == app;
+ return icon.app === app;
});
if (index === -1)
return;
highlight(index, justOutline) {
super.highlight(index, justOutline);
- this._label.set_text(index == -1 ? '' : this.icons[index].label.text);
+ this._label.set_text(index === -1 ? '' : this.icons[index].label.text);
}
_removeWindow(window) {
let index = this.icons.findIndex(icon => {
- return icon.window == window;
+ return icon.window === window;
});
if (index === -1)
return;
}
play() {
- if (this._isLoaded && this._timeoutId == 0) {
- if (this._frame == 0)
+ if (this._isLoaded && this._timeoutId === 0) {
+ if (this._frame === 0)
this._showFrame(0);
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, this._update.bind(this));
// If a category is present in all apps, its counter will
// reach appInfos.length
if (category.length > 0 &&
- categoryCounter[category] == appInfos.length)
+ categoryCounter[category] === appInfos.length)
categories.push(category);
}
return categories;
duration: VIEWS_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
};
- if (animationDirection == IconGrid.AnimationDirection.IN) {
+ if (animationDirection === IconGrid.AnimationDirection.IN) {
this.show();
params.opacity = 255;
params.delay = VIEWS_SWITCH_ANIMATION_DELAY;
super.animateSwitch(animationDirection);
if (this._currentDialog && this._displayingDialog &&
- animationDirection == IconGrid.AnimationDirection.OUT) {
+ animationDirection === IconGrid.AnimationDirection.OUT) {
this._currentDialog.ease({
opacity: 0,
duration: VIEWS_SWITCH_TIME,
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
let numItems = this._orderedItems.length;
- let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL;
+ let rtl = icon.get_text_direction() === Clutter.TextDirection.RTL;
for (let i = 0; i < 4; i++) {
const style = `width: ${subSize}px; height: ${subSize}px;`;
let bin = new St.Bin({style});
// Remove the folder if this is the last app icon; otherwise,
// just remove the icon
- if (folderApps.length == 0) {
+ if (folderApps.length === 0) {
this._deletingFolder = true;
// Resetting all keys deletes the relocatable schema
}
_setHoveringByDnd(hovering) {
- if (this._otherIconIsHovering == hovering)
+ if (this._otherIconIsHovering === hovering)
return;
super._setHoveringByDnd(hovering);
_updateName() {
let name = _getFolderName(this._folder);
- if (this.name == name)
+ if (this.name === name)
return;
this._name = name;
}
vfunc_key_press_event(event) {
- if (global.stage.get_key_focus() != this)
+ if (global.stage.get_key_focus() !== this)
return Clutter.EVENT_PROPAGATE;
// Since we need to only grab focus on one item child when the user
// and TAB_BACKWARD for up key and left key on ltr
// languages
let direction;
- let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR;
+ let isLtr = Clutter.get_default_text_direction() === Clutter.TextDirection.LTR;
switch (event.get_key_symbol()) {
case Clutter.KEY_Down:
direction = St.DirectionType.TAB_FORWARD;
}
_updateRunningStyle() {
- if (this.app.state != Shell.AppState.STOPPED)
+ if (this.app.state !== Shell.AppState.STOPPED)
this._dot.show();
else
this._dot.hide();
activate(button) {
let event = Clutter.get_current_event();
let modifiers = event ? event.get_state() : 0;
- let isMiddleButton = button && button == Clutter.BUTTON_MIDDLE;
- let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0;
+ let isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
+ let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) !== 0;
let openNewWindow = this.app.can_open_new_window() &&
- this.app.state == Shell.AppState.RUNNING &&
+ this.app.state === Shell.AppState.RUNNING &&
(isCtrlPressed || isMiddleButton);
- if (this.app.state == Shell.AppState.STOPPED || openNewWindow)
+ if (this.app.state === Shell.AppState.STOPPED || openNewWindow)
this.animateLaunch();
if (openNewWindow)
_canAccept(source) {
let view = _getViewFromIcon(source);
- return source != this &&
+ return source !== this &&
(source instanceof this.constructor) &&
(view instanceof AppDisplay);
}
_setHoveringByDnd(hovering) {
- if (this._otherIconIsHovering == hovering)
+ if (this._otherIconIsHovering === hovering)
return;
super._setHoveringByDnd(hovering);
return false;
let ids = this._getIds();
- if (pos == -1)
+ if (pos === -1)
ids.push(appId);
else
ids.splice(pos, 0, appId);
if (!(appId in this._favorites))
return false;
- let ids = this._getIds().filter(id => id != appId);
+ let ids = this._getIds().filter(id => id !== appId);
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
return true;
}
CloseAsync(params, invocation) {
if (this._audioSelectionDialog &&
- this._audioSelectionDialog._sender == invocation.get_sender())
+ this._audioSelectionDialog._sender === invocation.get_sender())
this._audioSelectionDialog.close();
invocation.return_value(null);
let _backgroundCache = null;
function _fileEqual0(file1, file2) {
- if (file1 == file2)
+ if (file1 === file2)
return true;
if (!file1 || !file2)
(obj, theFile, otherFile, eventType) => {
// Ignore CHANGED and CREATED events, since in both cases
// we'll get a CHANGES_DONE_HINT event when done.
- if (eventType != Gio.FileMonitorEvent.CHANGED &&
- eventType != Gio.FileMonitorEvent.CREATED)
+ if (eventType !== Gio.FileMonitorEvent.CHANGED &&
+ eventType !== Gio.FileMonitorEvent.CREATED)
this.emit('file-changed', file);
});
if (settingsSchema in this._backgroundSources) {
let source = this._backgroundSources[settingsSchema];
source._useCount--;
- if (source._useCount == 0) {
+ if (source._useCount === 0) {
delete this._backgroundSources[settingsSchema];
source.destroy();
}
let shadingType = this._settings.get_enum(COLOR_SHADING_TYPE_KEY);
- if (shadingType == GDesktopEnums.BackgroundShading.SOLID)
+ if (shadingType === GDesktopEnums.BackgroundShading.SOLID)
this.set_color(color);
else
this.set_gradient(shadingType, color, secondColor);
let image = cache.load(files[i]);
if (image.is_loaded()) {
numPendingImages--;
- if (numPendingImages == 0)
+ if (numPendingImages === 0)
finish();
} else {
// eslint-disable-next-line no-loop-func
let id = image.connect('loaded', () => {
image.disconnect(id);
numPendingImages--;
- if (numPendingImages == 0)
+ if (numPendingImages === 0)
finish();
});
}
}
_queueUpdateAnimation() {
- if (this._updateAnimationTimeoutId != 0)
+ if (this._updateAnimationTimeoutId !== 0)
return;
if (!this._cancellable || this._cancellable.is_cancelled())
style = GDesktopEnums.BackgroundStyle.ZOOM; // Hardcode
} else {
style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
- if (style != GDesktopEnums.BackgroundStyle.NONE) {
+ if (style !== GDesktopEnums.BackgroundStyle.NONE) {
const colorScheme = this._interfaceSettings.get_enum('color-scheme');
const uri = this._settings.get_string(
colorScheme === GDesktopEnums.ColorScheme.PREFER_DARK
let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, theActor, state) => {
- if (state == Clutter.LongPressState.QUERY) {
- return (action.get_button() == 0 ||
- action.get_button() == 1) &&
+ if (state === Clutter.LongPressState.QUERY) {
+ return (action.get_button() === 0 ||
+ action.get_button() === 1) &&
!actor._backgroundMenu.isOpen;
}
- if (state == Clutter.LongPressState.ACTIVATE) {
+ if (state === Clutter.LongPressState.ACTIVATE) {
let [x, y] = action.get_coords();
openMenu(x, y);
actor._backgroundManager.ignoreRelease();
return true;
});
clickAction.connect('clicked', action => {
- if (action.get_button() == 3) {
+ if (action.get_button() === 3) {
let [x, y] = action.get_coords();
openMenu(x, y);
}
set value(value) {
value = Math.max(Math.min(value, this._maxValue), 0);
- if (this._value == value)
+ if (this._value === value)
return;
this._value = value;
set maximumValue(value) {
value = Math.max(value, 1);
- if (this._maxValue == value)
+ if (this._maxValue === value)
return;
this._maxValue = value;
}
set overdriveStart(value) {
- if (this._overdriveStart == value)
+ if (this._overdriveStart === value)
return;
if (value > this._maxValue) {
let borderWidth = themeNode.get_length('-arrow-border-width');
minSize += borderWidth * 2;
natSize += borderWidth * 2;
- if ((!isWidth && (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)) ||
- (isWidth && (this._arrowSide == St.Side.LEFT || this._arrowSide == St.Side.RIGHT))) {
+ if ((!isWidth && (this._arrowSide === St.Side.TOP || this._arrowSide === St.Side.BOTTOM)) ||
+ (isWidth && (this._arrowSide === St.Side.LEFT || this._arrowSide === St.Side.RIGHT))) {
let rise = themeNode.get_length('-arrow-rise');
minSize += rise;
natSize += rise;
let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size();
let [absX, absY] = this.get_transformed_position();
- if (this._arrowSide == St.Side.TOP ||
- this._arrowSide == St.Side.BOTTOM)
+ if (this._arrowSide === St.Side.TOP ||
+ this._arrowSide === St.Side.BOTTOM)
this._arrowOrigin = sourceX - absX + sourceWidth / 2;
else
this._arrowOrigin = sourceY - absY + sourceHeight / 2;
let [width, height] = area.get_surface_size();
let [boxWidth, boxHeight] = [width, height];
- if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)
+ if (this._arrowSide === St.Side.TOP || this._arrowSide === St.Side.BOTTOM)
boxHeight -= rise;
else
boxWidth -= rise;
// Translate so that box goes from 0,0 to boxWidth,boxHeight,
// with the arrow poking out of that
- if (this._arrowSide == St.Side.TOP)
+ if (this._arrowSide === St.Side.TOP)
cr.translate(0, rise);
- else if (this._arrowSide == St.Side.LEFT)
+ else if (this._arrowSide === St.Side.LEFT)
cr.translate(rise, 0);
let [x1, y1] = [halfBorder, halfBorder];
if (rise) {
switch (this._arrowSide) {
case St.Side.TOP:
- if (this._arrowOrigin == x1)
+ if (this._arrowOrigin === x1)
skipTopLeft = true;
- else if (this._arrowOrigin == x2)
+ else if (this._arrowOrigin === x2)
skipTopRight = true;
break;
case St.Side.RIGHT:
- if (this._arrowOrigin == y1)
+ if (this._arrowOrigin === y1)
skipTopRight = true;
- else if (this._arrowOrigin == y2)
+ else if (this._arrowOrigin === y2)
skipBottomRight = true;
break;
case St.Side.BOTTOM:
- if (this._arrowOrigin == x1)
+ if (this._arrowOrigin === x1)
skipBottomLeft = true;
- else if (this._arrowOrigin == x2)
+ else if (this._arrowOrigin === x2)
skipBottomRight = true;
break;
case St.Side.LEFT:
- if (this._arrowOrigin == y1)
+ if (this._arrowOrigin === y1)
skipTopLeft = true;
- else if (this._arrowOrigin == y2)
+ else if (this._arrowOrigin === y2)
skipBottomLeft = true;
break;
}
}
cr.moveTo(x1 + borderRadius, y1);
- if (this._arrowSide == St.Side.TOP && rise) {
+ if (this._arrowSide === St.Side.TOP && rise) {
if (skipTopLeft) {
cr.moveTo(x1, y2 - borderRadius);
cr.lineTo(x1, y1 - rise);
3 * Math.PI / 2, Math.PI * 2);
}
- if (this._arrowSide == St.Side.RIGHT && rise) {
+ if (this._arrowSide === St.Side.RIGHT && rise) {
if (skipTopRight) {
cr.lineTo(x2 + rise, y1);
cr.lineTo(x2 + rise, y1 + halfBase);
0, Math.PI / 2);
}
- if (this._arrowSide == St.Side.BOTTOM && rise) {
+ if (this._arrowSide === St.Side.BOTTOM && rise) {
if (skipBottomLeft) {
cr.lineTo(x1 + halfBase, y2);
cr.lineTo(x1, y2 + rise);
Math.PI / 2, Math.PI);
}
- if (this._arrowSide == St.Side.LEFT && rise) {
+ if (this._arrowSide === St.Side.LEFT && rise) {
if (skipTopLeft) {
cr.lineTo(x1, y1 + halfBase);
cr.lineTo(x1 - rise, y1);
}
setPosition(sourceActor, alignment) {
- if (!this._sourceActor || sourceActor != this._sourceActor) {
+ if (!this._sourceActor || sourceActor !== this._sourceActor) {
this._sourceActor?.disconnectObject(this);
this._sourceActor = sourceActor;
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
// the left for St.Side.TOP and St.Side.BOTTOM.
setArrowOrigin(origin) {
- if (this._arrowOrigin != origin) {
+ if (this._arrowOrigin !== origin) {
this._arrowOrigin = origin;
this._border.queue_repaint();
}
// Differently from setPosition, this will not move the boxpointer itself,
// on the arrow
setArrowActor(actor) {
- if (this._arrowActor != actor) {
+ if (this._arrowActor !== actor) {
this._arrowActor = actor;
this._border.queue_repaint();
}
_updateFlip(allocationBox) {
let arrowSide = this._calculateArrowSide(this._userArrowSide);
- if (this._arrowSide != arrowSide) {
+ if (this._arrowSide !== arrowSide) {
this._arrowSide = arrowSide;
this._reposition(allocationBox);
const NC_ = (context, str) => `${context}\u0004${str}`;
function sameYear(dateA, dateB) {
- return dateA.getYear() == dateB.getYear();
+ return dateA.getYear() === dateB.getYear();
}
function sameMonth(dateA, dateB) {
- return sameYear(dateA, dateB) && (dateA.getMonth() == dateB.getMonth());
+ return sameYear(dateA, dateB) && (dateA.getMonth() === dateB.getMonth());
}
function sameDay(dateA, dateB) {
- return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate());
+ return sameMonth(dateA, dateB) && (dateA.getDate() === dateB.getDate());
}
function _isWorkDay(date) {
});
label.accessible_name = formatDateWithCFormatString(iter, '%A');
let col;
- if (this.get_text_direction() == Clutter.TextDirection.RTL)
+ if (this.get_text_direction() === Clutter.TextDirection.RTL)
col = 6 - (7 + iter.getDay() - this._weekStart) % 7;
else
col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
_onPrevMonthButtonClicked() {
let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth();
- if (oldMonth == 0) {
+ if (oldMonth === 0) {
newDate.setMonth(11);
newDate.setFullYear(newDate.getFullYear() - 1);
- if (newDate.getMonth() != 11) {
+ if (newDate.getMonth() !== 11) {
let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate();
newDate = new Date(newDate.getFullYear() - 1, 11, day);
}
} else {
newDate.setMonth(oldMonth - 1);
- if (newDate.getMonth() != oldMonth - 1) {
+ if (newDate.getMonth() !== oldMonth - 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth - 1, 32).getDate();
newDate = new Date(newDate.getFullYear(), oldMonth - 1, day);
}
_onNextMonthButtonClicked() {
let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth();
- if (oldMonth == 11) {
+ if (oldMonth === 11) {
newDate.setMonth(0);
newDate.setFullYear(newDate.getFullYear() + 1);
- if (newDate.getMonth() != 0) {
+ if (newDate.getMonth() !== 0) {
let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate();
newDate = new Date(newDate.getFullYear() + 1, 0, day);
}
} else {
newDate.setMonth(oldMonth + 1);
- if (newDate.getMonth() != oldMonth + 1) {
+ if (newDate.getMonth() !== oldMonth + 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth + 1, 32).getDate();
newDate = new Date(newDate.getFullYear(), oldMonth + 1, day);
}
this._markedAsToday = now;
let daysToWeekStart = (7 + beginDate.getDay() - this._weekStart) % 7;
- let startsOnWeekStart = daysToWeekStart == 0;
+ let startsOnWeekStart = daysToWeekStart === 0;
let weekPadding = startsOnWeekStart ? 7 : 0;
beginDate.setDate(beginDate.getDate() - (weekPadding + daysToWeekStart));
label: formatDateWithCFormatString(iter, C_('date day number format', '%d')),
can_focus: true,
});
- let rtl = button.get_text_direction() == Clutter.TextDirection.RTL;
+ let rtl = button.get_text_direction() === Clutter.TextDirection.RTL;
if (this._eventSource instanceof EmptyEventSource)
button.reactive = false;
styleClass += ' calendar-weekend';
// Hack used in lieu of border-collapse - see gnome-shell.css
- if (row == 2)
+ if (row === 2)
styleClass = `calendar-day-top ${styleClass}`;
let leftMost = rtl
- ? iter.getDay() == (this._weekStart + 6) % 7
- : iter.getDay() == this._weekStart;
+ ? iter.getDay() === (this._weekStart + 6) % 7
+ : iter.getDay() === this._weekStart;
if (leftMost)
styleClass = `calendar-day-left ${styleClass}`;
if (sameDay(now, iter))
styleClass += ' calendar-today';
- else if (iter.getMonth() != this._selectedDate.getMonth())
+ else if (iter.getMonth() !== this._selectedDate.getMonth())
styleClass += ' calendar-other-month';
if (hasEvents)
this._buttons.push(button);
- if (this._useWeekdate && iter.getDay() == 4) {
+ if (this._useWeekdate && iter.getDay() === 4) {
const label = new St.Label({
text: formatDateWithCFormatString(iter, '%V'),
style_class: 'calendar-week-number',
iter.setDate(iter.getDate() + 1);
- if (iter.getDay() == this._weekStart)
+ if (iter.getDay() === this._weekStart)
row++;
}
let message = new NotificationMessage(notification);
message.setSecondaryActor(new TimeLabel(notification.datetime));
- let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
+ let isUrgent = notification.urgency === MessageTray.Urgency.CRITICAL;
notification.connectObject(
'destroy', () => {
vfunc_map() {
this._messages.forEach(message => {
- if (message.notification.urgency != MessageTray.Urgency.CRITICAL)
+ if (message.notification.urgency !== MessageTray.Urgency.CRITICAL)
message.notification.acknowledged = true;
});
super.vfunc_map();
let shouldTrack;
if (focusWindow != null)
- shouldTrack = focusWindow == this._window;
+ shouldTrack = focusWindow === this._window;
else
shouldTrack = keyFocus && this._dialog.contains(keyFocus);
if (volume == null)
return true;
- return volume.get_identifier('class') == 'network';
+ return volume.get_identifier('class') === 'network';
}
function startAppForMount(app, mount) {
}
_getSourceForMount(mount) {
- let filtered = this._sources.filter(source => source.mount == mount);
+ let filtered = this._sources.filter(source => source.mount === mount);
// we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length
// is always either 1 or 0.
- if (filtered.length == 1)
+ if (filtered.length === 1)
return filtered[0];
return null;
// check at the settings for the first content type
// to see whether we should ask
- if (setting == AutorunSetting.IGNORE)
+ if (setting === AutorunSetting.IGNORE)
return; // return right away
let success = false;
let app = null;
- if (setting == AutorunSetting.RUN)
+ if (setting === AutorunSetting.RUN)
app = Gio.app_info_get_default_for_type(contentTypes[0], false);
- else if (setting == AutorunSetting.FILES)
+ else if (setting === AutorunSetting.FILES)
app = Gio.app_info_get_default_for_type('inode/directory', false);
if (app)
_validateWpaPsk(secret) {
let value = secret.value;
- if (value.length == 64) {
+ if (value.length === 64) {
// must be composed of hexadecimal digits only
for (let i = 0; i < 64; i++) {
if (!((value[i] >= 'a' && value[i] <= 'f') ||
_validateStaticWep(secret) {
let value = secret.value;
- if (secret.wep_key_type == NM.WepKeyType.KEY) {
- if (value.length == 10 || value.length == 26) {
+ if (secret.wep_key_type === NM.WepKeyType.KEY) {
+ if (value.length === 10 || value.length === 26) {
for (let i = 0; i < value.length; i++) {
if (!((value[i] >= 'a' && value[i] <= 'f') ||
(value[i] >= 'A' && value[i] <= 'F') ||
(value[i] >= '0' && value[i] <= '9')))
return false;
}
- } else if (value.length == 5 || value.length == 13) {
+ } else if (value.length === 5 || value.length === 13) {
for (let i = 0; i < value.length; i++) {
if (!((value[i] >= 'a' && value[i] <= 'z') ||
(value[i] >= 'A' && value[i] <= 'Z')))
} else {
return false;
}
- } else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) {
+ } else if (secret.wep_key_type === NM.WepKeyType.PASSPHRASE) {
if (value.length < 0 || value.length > 64)
return false;
}
_getWirelessSecrets(secrets, _wirelessSetting) {
let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
- if (this._settingName == '802-1x') {
+ if (this._settingName === '802-1x') {
this._get8021xSecrets(secrets);
return;
}
});
break;
case 'ieee8021x':
- if (wirelessSecuritySetting.auth_alg == 'leap') { // Cisco LEAP
+ if (wirelessSecuritySetting.auth_alg === 'leap') { // Cisco LEAP
secrets.push({
label: _('Password'),
key: 'leap-password',
let ieee8021xSetting = this._connection.get_setting_802_1x();
/* If hints were given we know exactly what we need to ask */
- if (this._settingName == '802-1x' && this._hints.length) {
+ if (this._settingName === '802-1x' && this._hints.length) {
if (this._hints.includes('identity')) {
secrets.push({
label: _('Username'),
_getMobileSecrets(secrets, connectionType) {
let setting;
- if (connectionType == 'bluetooth')
+ if (connectionType === 'bluetooth')
setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm();
else
setting = this._connection.get_setting_by_name(connectionType);
let [exited, exitStatus] = Shell.util_wifexited(status);
if (exited) {
- if (exitStatus != 0)
+ if (exitStatus !== 0)
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
else
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
}
_vpnChildProcessLineOldStyle(line) {
- if (this._previousLine != undefined) {
+ if (this._previousLine !== undefined) {
// Two consecutive newlines mean that the child should be closed
// (the actual newlines are eaten by Gio.DataInputStream)
// Send a termination message
- if (line == '' && this._previousLine == '') {
+ if (line === '' && this._previousLine === '') {
try {
this._stdin.write('QUIT\n\n', null);
} catch (e) { /* ignore broken pipe errors */ }
data = new GLib.Bytes(this._dataStdout.peek_buffer());
keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE);
- if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2)
+ if (keyfile.get_integer(VPN_UI_GROUP, 'Version') !== 2)
throw new Error('Invalid plugin keyfile version, is %d');
contentOverride = {
let [groups, len_] = keyfile.get_groups();
for (let i = 0; i < groups.length; i++) {
- if (groups[i] == VPN_UI_GROUP)
+ if (groups[i] === VPN_UI_GROUP)
continue;
let value = keyfile.get_string(groups[i], 'Value');
}
_handleRequest(requestId, connection, settingName, hints, flags) {
- if (settingName == 'vpn') {
+ if (settingName === 'vpn') {
this._vpnRequest(requestId, connection, hints, flags);
return;
}
let resetDialog = () => {
this._sessionRequestTimeoutId = 0;
- if (this.state != ModalDialog.State.OPENED)
+ if (this.state !== ModalDialog.State.OPENED)
return GLib.SOURCE_REMOVE;
this._passwordEntry.hide();
/* Only observe contact text channels */
if (!(channel instanceof Tp.TextChannel) ||
- targetHandleType != Tp.HandleType.CONTACT)
+ targetHandleType !== Tp.HandleType.CONTACT)
continue;
this._createChatSource(account, conn, channel, channel.get_target_contact());
return;
}
- if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) {
+ if (chanType === Tp.IFACE_CHANNEL_TYPE_TEXT) {
this._approveTextChannel(account, conn, channel, dispatchOp, context);
} else {
context.fail(new Tp.Error({
async _approveTextChannel(account, conn, channel, dispatchOp, context) {
let [targetHandle_, targetHandleType] = channel.get_handle();
- if (targetHandleType != Tp.HandleType.CONTACT) {
+ if (targetHandleType !== Tp.HandleType.CONTACT) {
context.fail(new Tp.Error({
code: Tp.Error.INVALID_ARGUMENT,
message: 'Unsupported handle type',
}
_createPolicy() {
- if (this._account.protocol_name == 'irc')
+ if (this._account.protocol_name === 'irc')
return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari');
return new MessageTray.NotificationApplicationPolicy('empathy');
}
let oldAlias = this.title;
let newAlias = this._contact.get_alias();
- if (oldAlias == newAlias)
+ if (oldAlias === newAlias)
return;
this.setTitle(newAlias);
// fallback to something else if activation fails
let target;
- if (this._channel.connection.protocol_name == 'irc')
+ if (this._channel.connection.protocol_name === 'irc')
target = 'org.freedesktop.Telepathy.Client.Polari';
else
target = 'org.freedesktop.Telepathy.Client.Empathy.Chat';
for (let i = 0; i < pendingTpMessages.length; i++) {
let message = pendingTpMessages[i];
- if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
+ if (message.get_message_type() === Tp.ChannelTextMessageType.DELIVERY_REPORT)
continue;
pendingMessages.push(ChatMessage.newFromTpMessage(message,
// Skip any log messages that are also in pendingMessages
for (let j = 0; j < pendingMessages.length; j++) {
let pending = pendingMessages[j];
- if (logMessage.timestamp == pending.timestamp && logMessage.text == pending.text) {
+ if (logMessage.timestamp === pending.timestamp && logMessage.text === pending.text) {
isPending = true;
break;
}
}
// Keep source alive while the channel is open
- if (reason != MessageTray.NotificationDestroyedReason.SOURCE_CLOSED)
+ if (reason !== MessageTray.NotificationDestroyedReason.SOURCE_CLOSED)
return;
if (this._destroyed)
}
_messageReceived(channel, message) {
- if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
+ if (message.get_message_type() === Tp.ChannelTextMessageType.DELIVERY_REPORT)
return;
this._ensureNotification();
// Wait a bit before notifying for the received message, a handler
// could ack it in the meantime.
- if (this._notifyTimeoutId != 0)
+ if (this._notifyTimeoutId !== 0)
GLib.source_remove(this._notifyTimeoutId);
this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500,
this._notifyTimeout.bind(this));
}
_notifyTimeout() {
- if (this._pendingMessages.length != 0)
+ if (this._pendingMessages.length !== 0)
this.showNotification();
this._notifyTimeoutId = 0;
respond(text) {
let type;
- if (text.slice(0, 4) == '/me ') {
+ if (text.slice(0, 4) === '/me ') {
type = Tp.ChannelTextMessageType.ACTION;
text = text.slice(4);
} else {
// gnome-shell's entry and the Empathy conversation window. We could
// keep track of it with the ChatStateChanged signal but it is good
// enough right now.
- if (state != this._chatState) {
+ if (state !== this._chatState) {
this._chatState = state;
this._channel.set_chat_state_async(state, null);
}
this.countUpdated();
}
- if (this._pendingMessages.length == 0 &&
+ if (this._pendingMessages.length === 0 &&
this._banner && !this._banner.expanded)
this._banner.hide();
}
let messageBody = GLib.markup_escape_text(message.text, -1);
let styles = [message.direction];
- if (message.messageType == Tp.ChannelTextMessageType.ACTION) {
+ if (message.messageType === Tp.ChannelTextMessageType.ACTION) {
let senderAlias = GLib.markup_escape_text(message.sender, -1);
messageBody = `<i>${senderAlias}</i> ${messageBody}`;
styles.push('chat-action');
}
- if (message.direction == NotificationDirection.RECEIVED) {
+ if (message.direction === NotificationDirection.RECEIVED) {
this.update(this.source.title, messageBody, {
datetime: GLib.DateTime.new_from_unix_local(message.timestamp),
bannerMarkup: true,
});
}
- let group = message.direction == NotificationDirection.RECEIVED
+ let group = message.direction === NotificationDirection.RECEIVED
? 'received' : 'sent';
this._append({
// bottom
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
- if (adjustment.value == this._oldMaxScrollValue)
+ if (adjustment.value === this._oldMaxScrollValue)
this.scrollTo(St.Side.BOTTOM);
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
});
scrollTo(side) {
let adjustment = this._scrollArea.vscroll.adjustment;
- if (side == St.Side.TOP)
+ if (side === St.Side.TOP)
adjustment.value = adjustment.lower;
- else if (side == St.Side.BOTTOM)
+ else if (side === St.Side.BOTTOM)
adjustment.value = adjustment.upper;
}
body.add_style_class_name(styles[i]);
let group = message.group;
- if (group != this._lastGroup) {
+ if (group !== this._lastGroup) {
this._lastGroup = group;
body.add_style_class_name('chat-new-group');
}
_onEntryActivated() {
let text = this._responseEntry.get_text();
- if (text == '')
+ if (text === '')
return;
this._inputHistory.addItem(text);
this._composingTimeoutId = 0;
}
- if (text != '') {
+ if (text !== '') {
this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING);
this._composingTimeoutId = GLib.timeout_add_seconds(
if (root instanceof St.Widget)
global.focus_manager.remove_group(root);
for (let i = 0; i < this._items.length; i++) {
- if (this._items[i].root == root) {
+ if (this._items[i].root === root) {
this._items.splice(i, 1);
return;
}
// they will have the same left-to-right ordering in the
// Ctrl-Alt-Tab dialog as they do onscreen.
_sortItems(a, b) {
- if (a.sortGroup != b.sortGroup)
+ if (a.sortGroup !== b.sortGroup)
return a.sortGroup - b.sortGroup;
let [ax] = a.proxy.get_transformed_position();
for (let i = 0; i < windows.length; i++) {
let icon = null;
let iconName = null;
- if (windows[i].get_window_type() == Meta.WindowType.DESKTOP) {
+ if (windows[i].get_window_type() === Meta.WindowType.DESKTOP) {
iconName = 'video-display-symbolic';
} else {
let app = windowTracker.get_window_app(windows[i]);
}
_keyPressHandler(keysym, action) {
- if (action == Meta.KeyBindingAction.SWITCH_PANELS)
+ if (action === Meta.KeyBindingAction.SWITCH_PANELS)
this._select(this._next());
- else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
+ else if (action === Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Left)
+ else if (keysym === Clutter.KEY_Left)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Right)
+ else if (keysym === Clutter.KEY_Right)
this._select(this._next());
else
return Clutter.EVENT_PROPAGATE;
}
setChild(actor) {
- if (this.child == actor)
+ if (this.child === actor)
return;
this.destroy_all_children();
};
DND.addDragMonitor(this._dragMonitor);
- if (this._box.get_n_children() == 0) {
+ if (this._box.get_n_children() === 0) {
this._emptyDropTarget = new EmptyDropTargetItem();
this._box.insert_child_at_index(this._emptyDropTarget, 0);
this._emptyDropTarget.show(true);
let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover();
if (shouldShow) {
- if (this._showLabelTimeoutId == 0) {
+ if (this._showLabelTimeoutId === 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
this._showLabelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
() => {
newIconSize = baseIconSizes[i];
}
- if (newIconSize == this.iconSize)
+ if (newIconSize === this.iconSize)
return;
let oldIconSize = this.iconSize;
let newApp = newApps.length > newIndex ? newApps[newIndex] : null;
// No change at oldIndex/newIndex
- if (oldApp == newApp) {
+ if (oldApp === newApp) {
oldIndex++;
newIndex++;
continue;
// App moved
let nextApp = newApps.length > newIndex + 1
? newApps[newIndex + 1] : null;
- let insertHere = nextApp && nextApp == oldApp;
+ let insertHere = nextApp && nextApp === oldApp;
let alreadyRemoved = removedActors.reduce((result, actor) => {
let removedApp = actor.child._delegate.app;
- return result || removedApp == newApp;
+ return result || removedApp === newApp;
}, false);
if (insertHere || alreadyRemoved) {
this._dragPlaceholderPos = pos;
// Don't allow positioning before or after self
- if (favPos != -1 && (pos == favPos || pos == favPos + 1)) {
+ if (favPos !== -1 && (pos === favPos || pos === favPos + 1)) {
this._clearDragPlaceholder();
return DND.DragMotionResult.CONTINUE;
}
if (!this._dragPlaceholder)
return DND.DragMotionResult.NO_DROP;
- let srcIsFavorite = favPos != -1;
+ let srcIsFavorite = favPos !== -1;
if (srcIsFavorite)
return DND.DragMotionResult.MOVE_DROP;
let children = this._box.get_children();
for (let i = 0; i < this._dragPlaceholderPos; i++) {
if (this._dragPlaceholder &&
- children[i] == this._dragPlaceholder)
+ children[i] === this._dragPlaceholder)
continue;
let childId = children[i].child._delegate.app.get_id();
- if (childId == id)
+ if (childId === id)
continue;
if (childId in favorites)
favPos++;
}
vfunc_event(event) {
- if (event.type() == Clutter.EventType.KEY_PRESS) {
+ if (event.type() === Clutter.EventType.KEY_PRESS) {
this._pressedKey = event.get_key_symbol();
- } else if (event.type() == Clutter.EventType.KEY_RELEASE) {
+ } else if (event.type() === Clutter.EventType.KEY_RELEASE) {
let pressedKey = this._pressedKey;
this._pressedKey = null;
let symbol = event.get_key_symbol();
- if (symbol != pressedKey)
+ if (symbol !== pressedKey)
return Clutter.EVENT_PROPAGATE;
let buttonInfo = this._buttonKeys[symbol];
this.actor.connect('destroy', () => {
this._actorDestroyed = true;
- if (this._dragState == DragState.DRAGGING && this._dragCancellable)
+ if (this._dragState === DragState.DRAGGING && this._dragCancellable)
this._cancelDrag(global.get_current_time());
this.disconnectAll();
});
}
_onButtonPress(actor, event) {
- if (event.get_button() != 1)
+ if (event.get_button() !== 1)
return Clutter.EVENT_PROPAGATE;
this._grabActor(event.get_device());
if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE;
- if (event.type() != Clutter.EventType.TOUCH_BEGIN ||
+ if (event.type() !== Clutter.EventType.TOUCH_BEGIN ||
!global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
return Clutter.EVENT_PROPAGATE;
}
_eventIsRelease(event) {
- if (event.type() == Clutter.EventType.BUTTON_RELEASE) {
+ if (event.type() === Clutter.EventType.BUTTON_RELEASE) {
let buttonMask = Clutter.ModifierType.BUTTON1_MASK |
Clutter.ModifierType.BUTTON2_MASK |
Clutter.ModifierType.BUTTON3_MASK;
/* We only obey the last button release from the device,
* other buttons may get pressed/released during the DnD op.
*/
- return (event.get_state() & buttonMask) == 0;
- } else if (event.type() == Clutter.EventType.TOUCH_END) {
+ return (event.get_state() & buttonMask) === 0;
+ } else if (event.type() === Clutter.EventType.TOUCH_END) {
/* For touch, we only obey the pointer emulating sequence */
return global.display.is_pointer_emulating_sequence(event.get_event_sequence());
}
let device = event.get_device();
if (this._grabbedDevice &&
- device != this._grabbedDevice &&
- device.get_device_type() != Clutter.InputDeviceType.KEYBOARD_DEVICE)
+ device !== this._grabbedDevice &&
+ device.get_device_type() !== Clutter.InputDeviceType.KEYBOARD_DEVICE)
return Clutter.EVENT_PROPAGATE;
// We intercept BUTTON_RELEASE event to know that the button was released in case we
// to complete the drag and ensure that whatever happens to be under the pointer does
// not get triggered if the drag was cancelled with Esc.
if (this._eventIsRelease(event)) {
- if (this._dragState == DragState.DRAGGING) {
+ if (this._dragState === DragState.DRAGGING) {
return this._dragActorDropped(event);
- } else if ((this._dragActor != null || this._dragState == DragState.CANCELLED) &&
+ } else if ((this._dragActor != null || this._dragState === DragState.CANCELLED) &&
!this._animationInProgress) {
// Drag must have been cancelled with Esc.
this._dragComplete();
}
// We intercept MOTION event to figure out if the drag has started and to draw
// this._dragActor under the pointer when dragging is in progress
- } else if (event.type() == Clutter.EventType.MOTION ||
- (event.type() == Clutter.EventType.TOUCH_UPDATE &&
+ } else if (event.type() === Clutter.EventType.MOTION ||
+ (event.type() === Clutter.EventType.TOUCH_UPDATE &&
global.display.is_pointer_emulating_sequence(event.get_event_sequence()))) {
- if (this._dragActor && this._dragState == DragState.DRAGGING)
+ if (this._dragActor && this._dragState === DragState.DRAGGING)
return this._updateDragPosition(event);
- else if (this._dragActor == null && this._dragState != DragState.CANCELLED)
+ else if (this._dragActor == null && this._dragState !== DragState.CANCELLED)
return this._maybeStartDrag(event);
// We intercept KEY_PRESS event so that we can process Esc key press to cancel
// dragging and ignore all other key presses.
- } else if (event.type() == Clutter.EventType.KEY_PRESS && this._dragState == DragState.DRAGGING) {
+ } else if (event.type() === Clutter.EventType.KEY_PRESS && this._dragState === DragState.DRAGGING) {
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Escape) {
+ if (symbol === Clutter.KEY_Escape) {
this._cancelDrag(event.get_time());
return Clutter.EVENT_STOP;
}
if (currentDraggable)
return;
- if (device == undefined) {
+ if (device === undefined) {
let event = Clutter.get_current_event();
if (event)
device = event.get_device();
- if (device == undefined) {
+ if (device === undefined) {
let seat = Clutter.get_default_backend().get_default_seat();
device = seat.get_pointer();
}
this._finishAnimation();
this._dragActor = null;
- if (this._dragState == DragState.DRAGGING)
+ if (this._dragState === DragState.DRAGGING)
this._dragState = DragState.CANCELLED;
});
this._dragOrigOpacity = this._dragActor.opacity;
- if (this._dragActorOpacity != undefined)
+ if (this._dragActorOpacity !== undefined)
this._dragActor.opacity = this._dragActorOpacity;
this._snapBackX = this._dragStartX + this._dragOffsetX;
this._dragX + this._dragOffsetX,
this._dragY + this._dragOffsetY);
- if (this._dragActorMaxSize != undefined) {
+ if (this._dragActorMaxSize !== undefined) {
let currentSize = Math.max(scaledWidth, scaledHeight);
if (currentSize > this._dragActorMaxSize) {
let scale = this._dragActorMaxSize / currentSize;
let motionFunc = dragMonitors[i].dragMotion;
if (motionFunc) {
let result = motionFunc(dragEvent);
- if (result != DragMotionResult.CONTINUE) {
+ if (result !== DragMotionResult.CONTINUE) {
global.display.set_cursor(DRAG_CURSOR_MAP[result]);
dragEvent.targetActor.disconnect(targetActorDestroyHandlerId);
return GLib.SOURCE_REMOVE;
targX,
targY,
0);
- if (result != DragMotionResult.CONTINUE) {
+ if (result !== DragMotionResult.CONTINUE) {
global.display.set_cursor(DRAG_CURSOR_MAP[result]);
return GLib.SOURCE_REMOVE;
}
if (accepted) {
// If it accepted the drop without taking the actor,
// handle it ourselves.
- if (this._dragActor && this._dragActor.get_parent() == Main.uiGroup) {
+ if (this._dragActor && this._dragActor.get_parent() === Main.uiGroup) {
if (this._restoreOnSuccess) {
this._restoreDragActor(event.get_time());
return true;
_cancelDrag(eventTime) {
this.emit('drag-cancelled', eventTime);
- let wasCancelled = this._dragState == DragState.CANCELLED;
+ let wasCancelled = this._dragState === DragState.CANCELLED;
this._dragState = DragState.CANCELLED;
if (this._actorDestroyed || wasCancelled) {
}
vfunc_gesture_prepare(_actor) {
- if (this.get_n_current_points() == 0)
+ if (this.get_n_current_points() === 0)
return false;
if (!(this._allowedModes & Main.actionMode))
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
- return (this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
- (this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
- (this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
- (this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
+ return (this._side === St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
+ (this._side === St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
+ (this._side === St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
+ (this._side === St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
}
vfunc_gesture_progress(_actor) {
return true;
if ((offsetX > offsetY &&
- (this._side == St.Side.TOP || this._side == St.Side.BOTTOM)) ||
+ (this._side === St.Side.TOP || this._side === St.Side.BOTTOM)) ||
(offsetY > offsetX &&
- (this._side == St.Side.LEFT || this._side == St.Side.RIGHT))) {
+ (this._side === St.Side.LEFT || this._side === St.Side.RIGHT))) {
this.cancel();
return false;
}
let [x, y] = this.get_motion_coords(0);
let monitorRect = this._getMonitorRect(startX, startY);
- if ((this._side == St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
- (this._side == St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
- (this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
- (this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
+ if ((this._side === St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
+ (this._side === St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
+ (this._side === St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
+ (this._side === St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
this.emit('activated');
else
this.cancel();
}
_sync() {
- let open = this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED;
+ let open = this.state === ModalDialog.State.OPENING || this.state === ModalDialog.State.OPENED;
if (!open)
return;
}
// Only consider updates and upgrades if PackageKit is available.
- if (this._pkOfflineProxy && this._type == DialogType.RESTART) {
+ if (this._pkOfflineProxy && this._type === DialogType.RESTART) {
if (this._updateInfo.UpdateTriggered)
this._type = DialogType.UPDATE_RESTART;
else if (this._updateInfo.UpgradeTriggered)
function _easeActor(actor, params) {
actor.save_easing_state();
- if (params.duration != undefined)
+ if (params.duration !== undefined)
actor.set_easing_duration(params.duration);
delete params.duration;
- if (params.delay != undefined)
+ if (params.delay !== undefined)
actor.set_easing_delay(params.delay);
delete params.delay;
let repeatCount = 0;
- if (params.repeatCount != undefined)
+ if (params.repeatCount !== undefined)
repeatCount = params.repeatCount;
delete params.repeatCount;
let autoReverse = false;
- if (params.autoReverse != undefined)
+ if (params.autoReverse !== undefined)
autoReverse = params.autoReverse;
delete params.autoReverse;
// whether the transition should finish where it started
const isReversed = autoReverse && numIterations % 2 === 0;
- if (params.mode != undefined)
+ if (params.mode !== undefined)
actor.set_easing_mode(params.mode);
delete params.mode;
let duration = Math.floor(params.duration || 0);
let repeatCount = 0;
- if (params.repeatCount != undefined)
+ if (params.repeatCount !== undefined)
repeatCount = params.repeatCount;
delete params.repeatCount;
let autoReverse = false;
- if (params.autoReverse != undefined)
+ if (params.autoReverse !== undefined)
autoReverse = params.autoReverse;
delete params.autoReverse;
// cancel overwritten transition
actor.remove_transition(propName);
- if (duration == 0) {
+ if (duration === 0) {
let [obj, prop] = _getPropertyTarget(actor, propName);
if (!isReversed)
throw new Error(`property "${prop}" is not of type ${typeName}`);
}
- if (uuid != meta.uuid)
+ if (uuid !== meta.uuid)
throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name "${uuid}"`);
let extension = {
}
_onChanged(event) {
- if (event.type.indexOf(STATECHANGED) == 0)
+ if (event.type.indexOf(STATECHANGED) === 0)
this.emit('focus-changed', event);
- else if (event.type == CARETMOVED)
+ else if (event.type === CARETMOVED)
this.emit('caret-moved', event);
}
_initAtspi() {
- if (!this._atspiInited && Atspi.init() == 0) {
+ if (!this._atspiInited && Atspi.init() === 0) {
Atspi.set_timeout(250, 250);
this._atspiInited = true;
}
_isWithinGrabbedActor(actor) {
let currentActor = this.currentGrab.actor;
while (actor) {
- if (actor == currentActor)
+ if (actor === currentActor)
return true;
actor = actor.get_parent();
}
}
_takeModalGrab() {
- let firstGrab = this._modalCount == 0;
+ let firstGrab = this._modalCount === 0;
if (firstGrab) {
let grab = Main.pushModal(this._owner, this._modalParams);
if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
onCapturedEvent(event) {
let type = event.type();
- if (type == Clutter.EventType.KEY_PRESS &&
- event.get_key_symbol() == Clutter.KEY_Escape) {
+ if (type === Clutter.EventType.KEY_PRESS &&
+ event.get_key_symbol() === Clutter.KEY_Escape) {
this.ungrab({isUser: true});
return Clutter.EVENT_STOP;
}
- let motion = type == Clutter.EventType.MOTION;
- let press = type == Clutter.EventType.BUTTON_PRESS;
- let release = type == Clutter.EventType.BUTTON_RELEASE;
+ let motion = type === Clutter.EventType.MOTION;
+ let press = type === Clutter.EventType.BUTTON_PRESS;
+ let release = type === Clutter.EventType.BUTTON_RELEASE;
let button = press || release;
- let touchUpdate = type == Clutter.EventType.TOUCH_UPDATE;
- let touchBegin = type == Clutter.EventType.TOUCH_BEGIN;
- let touchEnd = type == Clutter.EventType.TOUCH_END;
+ let touchUpdate = type === Clutter.EventType.TOUCH_UPDATE;
+ let touchBegin = type === Clutter.EventType.TOUCH_BEGIN;
+ let touchEnd = type === Clutter.EventType.TOUCH_END;
let touch = touchUpdate || touchBegin || touchEnd;
if (touch && !global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
}
setOrientation(orientation) {
- if (this._orientation == orientation)
+ if (this._orientation === orientation)
return;
this._orientation = orientation;
- if (this._orientation == IBus.Orientation.HORIZONTAL) {
+ if (this._orientation === IBus.Orientation.HORIZONTAL) {
this.vertical = false;
this.remove_style_class_name('vertical');
this.add_style_class_name('horizontal');
let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size();
let nPages = Math.ceil(nCandidates / pageSize);
- let page = cursorPos == 0 ? 0 : Math.floor(cursorPos / pageSize);
+ let page = cursorPos === 0 ? 0 : Math.floor(cursorPos / pageSize);
let startIndex = page * pageSize;
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
_setTextAttributes(clutterText, ibusAttrList) {
let attr;
for (let i = 0; (attr = ibusAttrList.get(i)); ++i) {
- if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
+ if (attr.get_attr_type() === IBus.AttrType.BACKGROUND)
clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
}
}
let row = this._rows[i];
/* When starting a new row, see if we need some padding */
- if (nCol == 0) {
+ if (nCol === 0) {
let diff = this._maxCols - row.width;
if (diff >= 1)
nCol = diff * KEY_SIZE / 2;
this.actor.contains(targetActor))
return Clutter.EVENT_PROPAGATE;
- if (event.type() == Clutter.EventType.BUTTON_RELEASE || event.type() == Clutter.EventType.TOUCH_END)
+ if (event.type() === Clutter.EventType.BUTTON_RELEASE || event.type() === Clutter.EventType.TOUCH_END)
this.close(true);
return Clutter.EVENT_STOP;
}
_release(button, commitString) {
- if (this._pressTimeoutId != 0) {
+ if (this._pressTimeoutId !== 0) {
GLib.source_remove(this._pressTimeoutId);
this._pressTimeoutId = 0;
}
}
cancel() {
- if (this._pressTimeoutId != 0) {
+ if (this._pressTimeoutId !== 0) {
GLib.source_remove(this._pressTimeoutId);
this._pressTimeoutId = 0;
}
_onCapturedEvent(actor, event) {
let type = event.type();
- let press = type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN;
- let release = type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END;
+ let press = type === Clutter.EventType.BUTTON_PRESS || type === Clutter.EventType.TOUCH_BEGIN;
+ let release = type === Clutter.EventType.BUTTON_RELEASE || type === Clutter.EventType.TOUCH_END;
const targetActor = global.stage.get_event_actor(event);
if (targetActor === this._boxPointer.bin ||
const slot = event.get_event_sequence().get_slot();
if (!this._touchPressSlot &&
- event.type() == Clutter.EventType.TOUCH_BEGIN) {
+ event.type() === Clutter.EventType.TOUCH_BEGIN) {
this._touchPressSlot = slot;
this._press(button, commitString);
button.add_style_pseudo_class('active');
}
getKeysForLevel(levelName) {
- return this._model.levels.find(level => level == levelName);
+ return this._model.levels.find(level => level === levelName);
}
}
}
set delta(value) {
- if (this._delta == value)
+ if (this._delta === value)
return;
this._delta = value;
let followingPage = this.getFollowingPage();
- if (this._followingPage != followingPage) {
+ if (this._followingPage !== followingPage) {
if (this._followingPanel) {
this._followingPanel.destroy();
this._followingPanel = null;
}
getFollowingPage() {
- if (this.delta == 0)
+ if (this.delta === 0)
return null;
if (this.delta < 0)
let pageKeys;
for (let j = 0; j < section.keys.length; j++) {
- if (j % itemsPerPage == 0) {
+ if (j % itemsPerPage === 0) {
page++;
pageKeys = [];
this._pages.push({pageKeys, nPages, page, section: this._sections[i]});
for (let i = 0; i < this._pages.length; i++) {
let page = this._pages[i];
- if (page.section == section && page.page == nPage)
+ if (page.section === section && page.page === nPage)
return i;
}
this._currentKey = key;
});
key.connect('commit', (actor, keyval, str) => {
- if (this._currentKey != key)
+ if (this._currentKey !== key)
return;
this._currentKey = null;
this.emit('emoji', str);
}
setCurrentPage(nPage) {
- if (this._curPage == nPage)
+ if (this._curPage === nPage)
return;
this._curPage = nPage;
}
/* Reuse followingPage if possible */
- if (nPage == this._followingPage) {
+ if (nPage === this._followingPage) {
this._panel = this._followingPanel;
this._followingPanel = null;
}
for (let i = 0; i < this._pages.length; i++) {
let page = this._pages[i];
- if (page.section == section && page.page == nPage) {
+ if (page.section === section && page.page === nPage) {
this.setCurrentPage(i);
break;
}
for (let i = 0; i < this._sections.length; i++) {
let sect = this._sections[i];
- sect.button.setLatched(sectionLabel == sect.label);
+ sect.button.setLatched(sectionLabel === sect.label);
}
}
_findSection(emoji) {
for (let i = 0; i < this._sections.length; i++) {
- if (this._sections[i].first == emoji)
+ if (this._sections[i].first === emoji)
return this._sections[i];
}
return false;
let deviceType = this._lastDevice.get_device_type();
- return deviceType == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
+ return deviceType === Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
}
_syncEnabled() {
* basically). We however make things consistent by skipping that
* second level.
*/
- let level = i >= 1 && levels.length == 3 ? i + 1 : i;
+ let level = i >= 1 && levels.length === 3 ? i + 1 : i;
let layout = new KeyContainer();
layout.shiftKeys = [];
}
_onKeypadVisible(controller, visible) {
- if (visible == this._keypadVisible)
+ if (visible === this._keypadVisible)
return;
this._keypadVisible = visible;
}
_onEmojiKeyVisible(controller, visible) {
- if (visible == this._emojiKeyVisible)
+ if (visible === this._emojiKeyVisible)
return;
this._emojiKeyVisible = visible;
_onKeyboardStateChanged(controller, state) {
let enabled;
- if (state == Clutter.InputPanelState.OFF)
+ if (state === Clutter.InputPanelState.OFF)
enabled = false;
- else if (state == Clutter.InputPanelState.ON)
+ else if (state === Clutter.InputPanelState.ON)
enabled = true;
- else if (state == Clutter.InputPanelState.TOGGLE)
- enabled = this._keyboardVisible == false;
+ else if (state === Clutter.InputPanelState.TOGGLE)
+ enabled = this._keyboardVisible === false;
else
return;
let layers = this._groups[activeGroupName];
let currentPage = layers[activeLevel];
- if (this._currentPage == currentPage) {
+ if (this._currentPage === currentPage) {
this._updateCurrentPageVisible();
return;
}
let emojiVisible = false;
let keypadVisible = false;
- if (purpose == Clutter.InputContentPurpose.NORMAL ||
- purpose == Clutter.InputContentPurpose.ALPHA ||
- purpose == Clutter.InputContentPurpose.PASSWORD ||
- purpose == Clutter.InputContentPurpose.TERMINAL)
+ if (purpose === Clutter.InputContentPurpose.NORMAL ||
+ purpose === Clutter.InputContentPurpose.ALPHA ||
+ purpose === Clutter.InputContentPurpose.PASSWORD ||
+ purpose === Clutter.InputContentPurpose.TERMINAL)
emojiVisible = true;
- if (purpose == Clutter.InputContentPurpose.DIGITS ||
- purpose == Clutter.InputContentPurpose.NUMBER ||
- purpose == Clutter.InputContentPurpose.PHONE)
+ if (purpose === Clutter.InputContentPurpose.DIGITS ||
+ purpose === Clutter.InputContentPurpose.NUMBER ||
+ purpose === Clutter.InputContentPurpose.PHONE)
keypadVisible = true;
this.emit('emoji-visible', emojiVisible);
if (string == null)
return false;
/* Let ibus methods fall through keyval emission */
- if (fromKey && this._currentSource.type == InputSourceManager.INPUT_SOURCE_TYPE_IBUS)
+ if (fromKey && this._currentSource.type === InputSourceManager.INPUT_SOURCE_TYPE_IBUS)
return false;
Main.inputMethod.commit(string);
}
set workArea(v) {
- if (v == this._workArea)
+ if (v === this._workArea)
return;
this._workArea = v;
if (this.actor)
_init() {
super._init();
- this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
+ this._rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
this.monitors = [];
this.primaryMonitor = null;
this.primaryIndex = -1;
display.get_monitor_scale(i)));
}
- if (nMonitors == 0) {
+ if (nMonitors === 0) {
this.primaryIndex = this.bottomIndex = -1;
- } else if (nMonitors == 1) {
+ } else if (nMonitors === 1) {
this.primaryIndex = this.bottomIndex = 0;
} else {
// If there are monitors below the primary, then we need
}
}
}
- if (this.primaryIndex != -1) {
+ if (this.primaryIndex !== -1) {
this.primaryMonitor = this.monitors[this.primaryIndex];
this.bottomMonitor = this.monitors[this.bottomIndex];
let haveTopLeftCorner = true;
- if (i != this.primaryIndex) {
+ if (i !== this.primaryIndex) {
// Check if we have a top left (right for RTL) corner.
// I.e. if there is no monitor directly above or to the left(right)
let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
let aboveY = cornerY - 1;
for (let j = 0; j < this.monitors.length; j++) {
- if (i == j)
+ if (i === j)
continue;
let otherMonitor = this.monitors[j];
if (besideX >= otherMonitor.x &&
_showSecondaryBackgrounds() {
for (let i = 0; i < this.monitors.length; i++) {
- if (i != this.primaryIndex) {
+ if (i !== this.primaryIndex) {
let backgroundActor = this._bgManagers[i].backgroundActor;
backgroundActor.show();
backgroundActor.opacity = 0;
let bgManager = this._createBackgroundManager(i);
this._bgManagers.push(bgManager);
- if (i != this.primaryIndex && this._startingUp)
+ if (i !== this.primaryIndex && this._startingUp)
bgManager.backgroundActor.hide();
}
trackChrome(actor, params = {}) {
let ancestor = actor.get_parent();
let index = this._findActor(ancestor);
- while (ancestor && index == -1) {
+ while (ancestor && index === -1) {
ancestor = ancestor.get_parent();
index = this._findActor(ancestor);
}
_findActor(actor) {
for (let i = 0; i < this._trackedActors.length; i++) {
let actorData = this._trackedActors[i];
- if (actorData.actor == actor)
+ if (actorData.actor === actor)
return i;
}
return -1;
}
_trackActor(actor, params) {
- if (this._findActor(actor) != -1)
+ if (this._findActor(actor) !== -1)
throw new Error('trying to re-track existing chrome actor');
let actorData = Params.parse(params, defaultParams);
_untrackActor(actor) {
let i = this._findActor(actor);
- if (i == -1)
+ if (i === -1)
return;
this._trackedActors.splice(i, 1);
_windowsRestacked() {
let changed = false;
- if (this._isPopupWindowVisible != global.top_window_group.get_children().some(isPopupMetaWindow))
+ if (this._isPopupWindowVisible !== global.top_window_group.get_children().some(isPopupMetaWindow))
changed = true;
if (changed) {
let px = 0.0;
let py = 0.0;
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
px = 1.0;
py = 0.0;
}
}
if (size > 0) {
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
this._verticalBarrier = new Meta.Barrier({
display: global.display,
x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
this.add_child(this._corner);
layoutManager.addChrome(this);
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
this._corner.set_position(this.width - this._corner.width, 0);
this.set_pivot_point(1.0, 0.0);
this.translation_x = -this.width;
}
handleDragOver(source, _actor, _x, _y, _time) {
- if (source != Main.xdndHandler)
+ if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
this._toggleOverview();
}
_onCornerLeft(actor, event) {
- if (event.get_related() != this)
+ if (event.get_related() !== this)
this._entered = false;
// Consume event, otherwise this will confuse onEnvironsLeft
return Clutter.EVENT_STOP;
}
_isHorizontal(barrier) {
- return barrier.y1 == barrier.y2;
+ return barrier.y1 === barrier.y2;
}
_getDistanceAcrossBarrier(barrier, event) {
// and add it to this._children as the new topmost actor.
this._container.set_child_above_sibling(this, newChild);
this._children.push(newChild);
- } else if (newChildIndex == 0) {
+ } else if (newChildIndex === 0) {
// Bottom of stack
this._children.unshift(newChild);
} else {
// Somewhere else; insert it into the correct spot
let prevChild = this._children.indexOf(children[newChildIndex - 1]);
- if (prevChild != -1) // paranoia
+ if (prevChild !== -1) // paranoia
this._children.splice(prevChild + 1, 0, newChild);
}
}
_actorRemoved(container, child) {
let index = this._children.indexOf(child);
- if (index != -1) // paranoia
+ if (index !== -1) // paranoia
this._children.splice(index, 1);
- if (child == this._highlighted)
+ if (child === this._highlighted)
this._highlighted = null;
}
* @param {Clutter.Actor=} window actor to highlight
*/
highlight(window) {
- if (this._highlighted == window)
+ if (this._highlighted === window)
return;
// Walk this._children raising and lowering actors as needed.
let below = this;
for (let i = this._children.length - 1; i >= 0; i--) {
- if (this._children[i] == window)
+ if (this._children[i] === window)
this._container.set_child_above_sibling(this._children[i], null);
- else if (this._children[i] == this._highlighted)
+ else if (this._children[i] === this._highlighted)
this._container.set_child_below_sibling(this._children[i], below);
else
below = this._children[i];
_syncEnabled() {
let enabled = this._settings.get_boolean(LOCATE_POINTER_KEY);
- if (enabled == !!this._ripples)
+ if (enabled === !!this._ripples)
return;
if (enabled) {
}
_processCompletionRequest(event) {
- if (event.completions.length == 0)
+ if (event.completions.length === 0)
return;
// Unique match = go ahead and complete; multiple matches + single tab = complete the common starting string;
// multiple matches + double tab = emit a suggest event with all possible options
- if (event.completions.length == 1) {
+ if (event.completions.length === 1) {
this.additionalCompletionText(event.completions[0], event.attrHead);
this.emit('completion', {completion: event.completions[0], type: 'whole-word'});
} else if (event.completions.length > 1 && event.tabType === 'single') {
_entryKeyPressEvent(actor, event) {
let cursorPos = this._entry.clutter_text.get_cursor_position();
let text = this._entry.get_text();
- if (cursorPos != -1)
+ if (cursorPos !== -1)
text = text.slice(0, cursorPos);
if (event.get_key_symbol() === Clutter.KEY_Tab)
vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
- if (this._selectedIndex == -1)
+ if (this._selectedIndex === -1)
this.selectIndex(0);
}
}
selectIndex(index) {
- if (index == this._selectedIndex)
+ if (index === this._selectedIndex)
return;
if (index < 0) {
this._unselect();
} else {
for (let i = 0; i < this._tabs.length; i++) {
let tabData = this._tabs[i];
- if (tabData.child == child) {
+ if (tabData.child === child) {
this.selectIndex(i);
return;
}
});
function objectToString(o) {
- if (typeof o == typeof objectToString) {
+ if (typeof o === typeof objectToString) {
// special case this since the default is way, way too verbose
return '<js function>';
} else if (o && o.toString === undefined) {
});
button.connect('clicked', this.close.bind(this));
hbox.add(button);
- if (typeof obj == typeof {}) {
+ if (typeof obj === typeof {}) {
let properties = [];
for (let propName in obj)
properties.push(propName);
case Clutter.ScrollDirection.DOWN:
// select child
- if (this._target != this._pointerTarget) {
+ if (this._target !== this._pointerTarget) {
let child = this._pointerTarget;
while (child) {
let parent = child.get_parent();
- if (parent == this._target)
+ if (parent === this._target)
break;
child = parent;
}
let target = global.stage.get_actor_at_pos(
Clutter.PickMode.ALL, stageX, stageY);
- if (target != this._pointerTarget)
+ if (target !== this._pointerTarget)
this._target = target;
this._pointerTarget = target;
return;
let extensionDisplay = this._createExtensionDisplay(extension);
- if (this._numExtensions == 0)
+ if (this._numExtensions === 0)
this._extensionsList.remove_actor(this._noExtensions);
this._numExtensions++;
// If a completion is completed unambiguously, the currently-displayed completion
// suggestions become irrelevant.
this._autoComplete.connect('completion', (a, e) => {
- if (e.type == 'whole-word')
+ if (e.type === 'whole-word')
this._hideCompletions();
});
// Handle key events which are relevant for all tabs of the LookingGlass
vfunc_key_press_event(event) {
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Escape) {
+ if (symbol === Clutter.KEY_Escape) {
this.close();
return Clutter.EVENT_STOP;
}
// Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
if (event.get_state() & Clutter.ModifierType.CONTROL_MASK) {
- if (symbol == Clutter.KEY_Page_Up)
+ if (symbol === Clutter.KEY_Page_Up)
this._notebook.prevTab();
- else if (symbol == Clutter.KEY_Page_Down)
+ else if (symbol === Clutter.KEY_Page_Down)
this._notebook.nextTab();
}
return super.vfunc_key_press_event(event);
}
set texture(coglTexture) {
- if (this._texture == coglTexture)
+ if (this._texture === coglTexture)
return;
let oldTexture = this._texture;
this.invalidate();
if (!oldTexture || !coglTexture ||
- oldTexture.get_width() != coglTexture.get_width() ||
- oldTexture.get_height() != coglTexture.get_height())
+ oldTexture.get_width() !== coglTexture.get_width() ||
+ oldTexture.get_height() !== coglTexture.get_height())
this.invalidate_size();
}
});
isActive() {
// Sufficient to check one ZoomRegion since Magnifier's active
// state applies to all of them.
- if (this._zoomRegions.length == 0)
+ if (this._zoomRegions.length === 0)
return false;
else
return this._zoomRegions[0].isActive();
if (zoomRegion) {
// Mag factor is accurate to two decimal places.
let aPref = parseFloat(this._settings.get_double(MAG_FACTOR_KEY).toFixed(2));
- if (aPref != 0.0)
+ if (aPref !== 0.0)
zoomRegion.setMagFactor(aPref, aPref);
aPref = this._settings.get_enum(SCREEN_POSITION_KEY);
if (this._zoomRegions.length) {
let position = this._settings.get_enum(SCREEN_POSITION_KEY);
this._zoomRegions[0].setScreenPosition(position);
- if (position != GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN)
+ if (position !== GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN)
this._updateLensMode();
}
}
}
_updateScreenPosition() {
- if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) {
+ if (this._screenPosition === GDesktopEnums.MagnifierScreenPosition.NONE) {
this._setViewPort({
x: this._viewPortX,
y: this._viewPortY,
_updateFocus(caller, event) {
let component = event.source.get_component_iface();
- if (!component || event.detail1 != 1)
+ if (!component || event.detail1 !== 1)
return;
let extents;
try {
* @param {boolean} activate Boolean to show/hide the ZoomRegion.
*/
setActive(activate) {
- if (activate == this.isActive())
+ if (activate === this.isActive())
return;
if (activate) {
}
_syncFocusTracking() {
- let enabled = this._focusTrackingMode != GDesktopEnums.MagnifierFocusTrackingMode.NONE &&
+ let enabled = this._focusTrackingMode !== GDesktopEnums.MagnifierFocusTrackingMode.NONE &&
this.isActive();
if (enabled)
}
_syncCaretTracking() {
- let enabled = this._caretTrackingMode != GDesktopEnums.MagnifierCaretTrackingMode.NONE &&
+ let enabled = this._caretTrackingMode !== GDesktopEnums.MagnifierCaretTrackingMode.NONE &&
this.isActive();
if (enabled)
*/
scrollToMousePos() {
this._followingCursor = true;
- if (this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE)
+ if (this._mouseTrackingMode !== GDesktopEnums.MagnifierMouseTrackingMode.NONE)
this._changeROI({redoCursorTracking: true});
else
this._updateMousePosition();
}
_destroyActors() {
- if (this._mouseActor == this._mouseSourceActor)
+ if (this._mouseActor === this._mouseSourceActor)
this._mouseActor.get_parent().remove_actor(this._mouseActor);
if (this._crossHairs)
this._crossHairs.removeFromParent(this._crossHairsActor);
this._yMagFactor = params.yMagFactor;
if (params.redoCursorTracking &&
- this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE) {
+ this._mouseTrackingMode !== GDesktopEnums.MagnifierMouseTrackingMode.NONE) {
// This depends on this.xMagFactor/yMagFactor already being updated
[params.xCenter, params.yCenter] = this._centerFromMousePosition();
}
// doesn't necessarily imply
// this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
- if (this._viewPortX != 0 || this._viewPortY != 0)
+ if (this._viewPortX !== 0 || this._viewPortY !== 0)
return false;
- if (this._viewPortWidth != global.screen_width ||
- this._viewPortHeight != global.screen_height)
+ if (this._viewPortWidth !== global.screen_width ||
+ this._viewPortHeight !== global.screen_height)
return false;
return true;
}
let xMouse = this._magnifier.xMouse;
let yMouse = this._magnifier.yMouse;
- if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL)
+ if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL)
return this._centerFromPointProportional(xMouse, yMouse);
- else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
+ else if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
return this._centerFromPointPush(xMouse, yMouse);
- else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED)
+ else if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.CENTERED)
return this._centerFromPointCentered(xMouse, yMouse);
return null; // Should never be hit
let xCaret = this._xCaret;
let yCaret = this._yCaret;
- if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.PROPORTIONAL)
+ if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.PROPORTIONAL)
[xCaret, yCaret] = this._centerFromPointProportional(xCaret, yCaret);
- else if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.PUSH)
+ else if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.PUSH)
[xCaret, yCaret] = this._centerFromPointPush(xCaret, yCaret);
- else if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.CENTERED)
+ else if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.CENTERED)
[xCaret, yCaret] = this._centerFromPointCentered(xCaret, yCaret);
this._scrollContentsToDelayed(xCaret, yCaret);
let xFocus = this._xFocus;
let yFocus = this._yFocus;
- if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.PROPORTIONAL)
+ if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.PROPORTIONAL)
[xFocus, yFocus] = this._centerFromPointProportional(xFocus, yFocus);
- else if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.PUSH)
+ else if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.PUSH)
[xFocus, yFocus] = this._centerFromPointPush(xFocus, yFocus);
- else if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.CENTERED)
+ else if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.CENTERED)
[xFocus, yFocus] = this._centerFromPointCentered(xFocus, yFocus);
this._scrollContentsToDelayed(xFocus, yFocus);
* addToZoomRegion
*/
removeFromParent(childActor) {
- if (childActor == this)
+ if (childActor === this)
childActor.get_parent().remove_actor(childActor);
else
childActor.destroy();
}
layoutManager.connect('startup-complete', () => {
- if (actionMode == Shell.ActionMode.NONE)
+ if (actionMode === Shell.ActionMode.NONE)
actionMode = Shell.ActionMode.NORMAL;
if (screenShield)
screenShield.lockIfWasLocked();
- if (sessionMode.currentMode != 'gdm' &&
- sessionMode.currentMode != 'initial-setup') {
+ if (sessionMode.currentMode !== 'gdm' &&
+ sessionMode.currentMode !== 'initial-setup') {
GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
'MESSAGE': `GNOME Shell started at ${_startDate}`,
'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID,
* global.get_current_time() is assumed.
*/
export function popModal(grab, timestamp) {
- if (timestamp == undefined)
+ if (timestamp === undefined)
timestamp = global.get_current_time();
let focusIndex = _findModal(grab);
record.grab.dismiss();
- if (focusIndex == modalActorFocusStack.length - 1) {
+ if (focusIndex === modalActorFocusStack.length - 1) {
if (record.prevFocus)
record.prevFocus.disconnect(record.prevFocusDestroyId);
actionMode = record.actionMode;
if (!time)
time = global.get_current_time();
- if (windowWorkspaceNum != activeWorkspaceNum) {
+ if (windowWorkspaceNum !== activeWorkspaceNum) {
let workspace = workspaceManager.get_workspace_by_index(windowWorkspaceNum);
workspace.activate_with_focus(window, time);
} else {
_deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback();
- if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) {
+ if (_deferredWorkQueue.length === 0 && _deferredTimeoutId > 0) {
GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0;
}
function _queueBeforeRedraw(workId) {
_beforeRedrawQueue.push(workId);
- if (_beforeRedrawQueue.length == 1) {
+ if (_beforeRedrawQueue.length === 1) {
const laters = global.compositor.get_laters();
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
_runBeforeRedrawQueue();
_deferredWorkQueue.push(workId);
if (data.actor.mapped) {
_queueBeforeRedraw(workId);
- } else if (_deferredTimeoutId == 0) {
+ } else if (_deferredTimeoutId === 0) {
_deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork();
_deferredTimeoutId = 0;
let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false);
if (hasColor) {
let linkColor = color.to_string().substr(0, 7);
- if (linkColor != this._linkColor) {
+ if (linkColor !== this._linkColor) {
this._linkColor = linkColor;
this._highlightUrls();
}
// Don't try to URL highlight when invisible.
// The MessageTray doesn't actually hide us, so
// we need to check for paint opacities as well.
- if (!this.visible || this.get_paint_opacity() == 0)
+ if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
// Keep Notification from seeing this and taking
}
vfunc_button_release_event(event) {
- if (!this.visible || this.get_paint_opacity() == 0)
+ if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
const urlId = this._findUrlAtPos(event);
- if (urlId != -1) {
+ if (urlId !== -1) {
let url = this._urls[urlId].url;
if (!url.includes(':'))
url = `http://${url}`;
}
vfunc_motion_event(event) {
- if (!this.visible || this.get_paint_opacity() == 0)
+ if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
const urlId = this._findUrlAtPos(event);
- if (urlId != -1 && !this._cursorChanged) {
+ if (urlId !== -1 && !this._cursorChanged) {
global.display.set_cursor(Meta.Cursor.POINTING_HAND);
this._cursorChanged = true;
- } else if (urlId == -1) {
+ } else if (urlId === -1) {
global.display.set_cursor(Meta.Cursor.DEFAULT);
this._cursorChanged = false;
}
}
vfunc_leave_event(event) {
- if (!this.visible || this.get_paint_opacity() == 0)
+ if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
if (this._cursorChanged) {
continue;
findPos = i;
}
- if (findPos != -1) {
+ if (findPos !== -1) {
for (let i = 0; i < this._urls.length; i++) {
if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > findPos)
}
_connectContainer(container) {
- if (this._container == container)
+ if (this._container === container)
return;
this._container?.disconnectObject(this);
}
set expansion(v) {
- if (v == this._expansion)
+ if (v === this._expansion)
return;
this._expansion = v;
this.notify('expansion');
let visibleIndex = this._expansion > 0 ? 1 : 0;
for (let i = 0; this._container && i < this._container.get_n_children(); i++)
- this._container.get_child_at_index(i).visible = i == visibleIndex;
+ this._container.get_child_at_index(i).visible = i === visibleIndex;
this.layout_changed();
}
set expandLines(v) {
- if (v == this._expandLines)
+ if (v === this._expandLines)
return;
this._expandLines = v;
if (this._expansion > 0)
vfunc_key_press_event(event) {
let keysym = event.get_key_symbol();
- if (keysym == Clutter.KEY_Delete ||
- keysym == Clutter.KEY_KP_Delete) {
+ if (keysym === Clutter.KEY_Delete ||
+ keysym === Clutter.KEY_KP_Delete) {
if (this.canClose()) {
this.close();
return Clutter.EVENT_STOP;
_sync() {
let messages = this._messages;
- let empty = messages.length == 0;
+ let empty = messages.length === 0;
- if (this._empty != empty) {
+ if (this._empty !== empty) {
this._empty = empty;
this.notify('empty');
}
let canClear = messages.some(m => m.canClose());
- if (this._canClear != canClear) {
+ if (this._canClear !== canClear) {
this._canClear = canClear;
this.notify('can-clear');
}
// will call .update() later on. This is the case of
// NotificationDaemon, which wants to use the same code
// for new and updated notifications
- if (arguments.length != 1)
+ if (arguments.length !== 1)
this.update(title, banner, params);
}
if (params.clear)
this.actions = [];
- if (this._soundName != params.soundName ||
- this._soundFile != params.soundFile) {
+ if (this._soundName !== params.soundName ||
+ this._soundFile !== params.soundFile) {
this._soundName = params.soundName;
this._soundFile = params.soundFile;
this._soundPlayed = false;
}
get narrowestPrivacyScope() {
- return this.notifications.every(n => n.privacyScope == PrivacyScope.SYSTEM)
+ return this.notifications.every(n => n.privacyScope === PrivacyScope.SYSTEM)
? PrivacyScope.SYSTEM
: PrivacyScope.USER;
}
setTitle(newTitle) {
- if (this.title == newTitle)
+ if (this.title === newTitle)
return;
this.title = newTitle;
this.notifications.splice(index, 1);
this.countUpdated();
- if (this.notifications.length == 0)
+ if (this.notifications.length === 0)
this.destroy();
}
if (notification.urgency === Urgency.LOW)
return;
- if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL)
+ if (this.policy.showBanners || notification.urgency === Urgency.CRITICAL)
this.emit('notification-show', notification);
}
}
_onNotificationKeyRelease(actor, event) {
- if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
+ if (event.get_key_symbol() === Clutter.KEY_Escape && event.get_state() === 0) {
this._expireNotification();
return Clutter.EVENT_STOP;
}
}
set bannerBlocked(v) {
- if (this._bannerBlocked == v)
+ if (this._bannerBlocked === v)
return;
this._bannerBlocked = v;
this._updateState();
let wasEnabled = this.contains(source);
let shouldBeEnabled = policy.enable;
- if (wasEnabled != shouldBeEnabled) {
+ if (wasEnabled !== shouldBeEnabled) {
if (shouldBeEnabled)
this._addSource(source);
else
}
_onNotificationShow(_source, notification) {
- if (this._notification == notification) {
+ if (this._notification === notification) {
// If a notification that is being shown is updated, we update
// how it is shown and extend the time until it auto-hides.
// If a new notification is updated while it is being hidden,
// notifications, as only banner mode allows expansion.
let bannerCount = this._notification ? 1 : 0;
let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
- if (!full || notification.urgency == Urgency.CRITICAL) {
+ if (!full || notification.urgency === Urgency.CRITICAL) {
notification.connect('destroy',
this._onNotificationDestroy.bind(this));
this._notificationQueue.push(notification);
}
_onNotificationHoverChanged() {
- if (this._bannerBin.hover == this._notificationHovered)
+ if (this._bannerBin.hover === this._notificationHovered)
return;
this._notificationHovered = this._bannerBin.hover;
}
_onStatusChanged(status) {
- if (status == GnomeSession.PresenceStatus.BUSY) {
+ if (status === GnomeSession.PresenceStatus.BUSY) {
// remove notification and allow the summary to be closed now
this._updateNotificationTimeout(0);
this._busy = true;
- } else if (status != GnomeSession.PresenceStatus.IDLE) {
+ } else if (status !== GnomeSession.PresenceStatus.IDLE) {
// We preserve the previous value of this._busy if the status turns to IDLE
// so that we don't start showing notifications queued during the BUSY state
// as the screensaver gets activated.
let hasNotifications = Main.sessionMode.hasNotifications;
- if (this._notificationState == State.HIDDEN) {
+ if (this._notificationState === State.HIDDEN) {
let nextNotification = this._notificationQueue[0] || null;
if (hasNotifications && nextNotification) {
let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen;
- let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL;
+ let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency === Urgency.CRITICAL;
if (showNextNotification)
this._showNotification();
}
} else if (this._notificationState === State.SHOWING ||
this._notificationState === State.SHOWN) {
let expired = (this._userActiveWhileNotificationShown &&
- this._notificationTimeoutId == 0 &&
- this._notification.urgency != Urgency.CRITICAL &&
+ this._notificationTimeoutId === 0 &&
+ this._notification.urgency !== Urgency.CRITICAL &&
!this._banner.focused &&
!this._pointerInNotification) || this._notificationExpired;
let mustClose = this._notificationRemoved || !hasNotifications || expired;
// We auto-expand notifications with CRITICAL urgency, or for which the relevant setting
// is on in the control center.
- if (this._notification.urgency == Urgency.CRITICAL ||
+ if (this._notification.urgency === Urgency.CRITICAL ||
this._notification.source.policy.forceExpanded)
this._expandBanner(true);
}
_showNotificationCompleted() {
- if (this._notification.urgency != Urgency.CRITICAL)
+ if (this._notification.urgency !== Urgency.CRITICAL)
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT);
}
// simpler.)
this._updateNotificationTimeout(1000);
} else if (this._useLongerNotificationLeftTimeout && !this._notificationLeftTimeoutId &&
- (x != this._lastSeenMouseX || y != this._lastSeenMouseY)) {
+ (x !== this._lastSeenMouseX || y !== this._lastSeenMouseY)) {
// Refresh the timeout if the notification originally
// popped up under the pointer, and the pointer is hovering
// inside it.
}
_setState(state) {
- if (this._state == state)
+ if (this._state === state)
return;
this._state = state;
}
open(timestamp, onPrimary) {
- if (this.state == State.OPENED || this.state == State.OPENING)
+ if (this.state === State.OPENED || this.state === State.OPENING)
return true;
if (!this.pushModal(timestamp))
}
close(timestamp) {
- if (this.state == State.CLOSED || this.state == State.CLOSING)
+ if (this.state === State.CLOSED || this.state === State.CLOSING)
return;
this._setState(State.CLOSING);
// immediately, but the lightbox should remain until the logout is
// complete.
_fadeOutDialog(timestamp) {
- if (this.state == State.CLOSED || this.state == State.CLOSING)
+ if (this.state === State.CLOSED || this.state === State.CLOSING)
return;
- if (this.state == State.FADED_OUT)
+ if (this.state === State.FADED_OUT)
return;
this.popModal(timestamp);
this._icon.add_style_class_name('fallback');
}
- let isPlaying = this._player.status == 'Playing';
+ let isPlaying = this._player.status === 'Playing';
let iconName = isPlaying
? 'media-playback-pause-symbolic'
: 'media-playback-start-symbolic';
let visible = this._playerProxy.CanPlay;
- if (this._visible != visible) {
+ if (this._visible !== visible) {
this._visible = visible;
if (visible)
this.emit('show');
_iconForNotificationData(icon) {
if (icon) {
- if (icon.substr(0, 7) == 'file://')
+ if (icon.substr(0, 7) === 'file://')
return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)});
- else if (icon[0] == '/')
+ else if (icon[0] === '/')
return new Gio.FileIcon({file: Gio.File.new_for_path(icon)});
else
return new Gio.ThemedIcon({name: icon});
_lookupSource(title, pid) {
for (let i = 0; i < this._sources.length; i++) {
let source = this._sources[i];
- if (source.pid == pid && source.initialTitle == title)
+ if (source.pid === pid && source.initialTitle === title)
return source;
}
return null;
//
// Note that empathy uses im.received for one to one chats and
// x-empathy.im.mentioned for multi-user, so we're good here
- if (appName == 'Empathy' && hints['category'] == 'im.received') {
+ if (appName === 'Empathy' && hints['category'] === 'im.received') {
// Ignore replacesId since we already sent back a
// NotificationClosed for that id.
id = this._nextNotificationId++;
hints,
timeout,
};
- if (replacesId != 0 && this._notifications[replacesId]) {
+ if (replacesId !== 0 && this._notifications[replacesId]) {
ndata.id = id = replacesId;
ndata.notification = this._notifications[replacesId].notification;
} else {
if (actions.length) {
for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i + 1]];
- if (actionId == 'default') {
+ if (actionId === 'default') {
hasDefaultAction = true;
} else {
notification.addAction(label, () => {
notification.setTransient(!!hints['transient']);
let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
- notification.setPrivacyScope(privacyScope == 'system'
+ notification.setPrivacyScope(privacyScope === 'system'
? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER);
this.iconUpdated();
let tracker = Shell.WindowTracker.get_default();
- if (notification.resident && this.app && tracker.focus_app == this.app)
+ if (notification.resident && this.app && tracker.focus_app === this.app)
this.pushNotification(notification);
else
this.showNotification(notification);
if (priority) {
let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
- this.setUrgency(urgency != undefined ? urgency : MessageTray.Urgency.NORMAL);
+ this.setUrgency(urgency !== undefined ? urgency : MessageTray.Urgency.NORMAL);
} else if (urgent) {
this.setUrgency(urgent.unpack()
? MessageTray.Urgency.CRITICAL
if (value) {
let sources = value.deepUnpack();
sources.forEach(([appId, notifications]) => {
- if (notifications.length == 0)
+ if (notifications.length === 0)
return;
let source;
_position() {
let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor);
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
this._box.x = workArea.x + (workArea.width - this._box.width);
else
this._box.x = workArea.x;
_trackClient(client) {
if (this._client)
- return this._client == client;
+ return this._client === client;
this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION,
}
_untrackClient(client) {
- if (!this._client || this._client != client)
+ if (!this._client || this._client !== client)
return false;
Gio.bus_unwatch_name(this._clientWatchId);
for (let connector in params) {
let monitor = this._monitorManager.get_monitor_for_connector(connector);
- if (monitor == -1)
+ if (monitor === -1)
continue;
this._monitorLabels.get(monitor).push(params[connector].deepUnpack());
}
}
setLabel(label) {
- this._label.visible = label != undefined;
+ this._label.visible = label !== undefined;
if (label)
this._label.text = label;
this._updateBoxVisibility();
}
setLevel(value) {
- this._level.visible = value != undefined;
- if (value != undefined) {
+ this._level.visible = value !== undefined;
+ if (value !== undefined) {
if (this.visible) {
this._level.ease_property('value', value, {
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
_monitorsChanged() {
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
- if (this._osdWindows[i] == undefined)
+ if (this._osdWindows[i] === undefined)
this._osdWindows[i] = new OsdWindow(i);
}
}
show(monitorIndex, icon, label, level, maxLevel) {
- if (monitorIndex != -1) {
+ if (monitorIndex !== -1) {
for (let i = 0; i < this._osdWindows.length; i++) {
- if (i == monitorIndex)
+ if (i === monitorIndex)
this._showOsdWindow(i, icon, label, level, maxLevel);
else
this._osdWindows[i].cancel();
}
let notification = null;
- if (this._source.notifications.length == 0) {
+ if (this._source.notifications.length === 0) {
notification = new MessageTray.Notification(this._source, text, null);
notification.setTransient(true);
notification.setForFeedback(forFeedback);
}
_resetWindowSwitchTimeout() {
- if (this._windowSwitchTimeoutId != 0) {
+ if (this._windowSwitchTimeoutId !== 0) {
GLib.source_remove(this._windowSwitchTimeoutId);
this._windowSwitchTimeoutId = 0;
}
this._windowSwitchTimestamp = global.get_current_time();
if (targetIsWindow &&
- dragEvent.targetActor._delegate.metaWindow == this._lastHoveredWindow)
+ dragEvent.targetActor._delegate.metaWindow === this._lastHoveredWindow)
return DND.DragMotionResult.CONTINUE;
this._lastHoveredWindow = null;
let event = Clutter.get_current_event();
if (event) {
let type = event.type();
- let button = type == Clutter.EventType.BUTTON_PRESS ||
- type == Clutter.EventType.BUTTON_RELEASE;
- let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0;
+ const button =
+ type === Clutter.EventType.BUTTON_PRESS ||
+ type === Clutter.EventType.BUTTON_RELEASE;
+ let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) !== 0;
if (button && ctrl)
return;
}
for (let i = 0; i < devices.length; i++) {
let device = devices[i];
- if (device == this.currentDevice)
+ if (device === this.currentDevice)
continue;
this._padChooserMenu.addAction(device.get_device_name(), () => {
}
vfunc_captured_event(event) {
- if (event.type() != Clutter.EventType.KEY_PRESS)
+ if (event.type() !== Clutter.EventType.KEY_PRESS)
return Clutter.EVENT_PROPAGATE;
const str = Meta.accelerator_name(
});
/* These actions only apply to pad buttons */
- if (selectedAction == GDesktopEnums.PadButtonAction.HELP ||
- selectedAction == GDesktopEnums.PadButtonAction.SWITCH_MONITOR)
+ if (selectedAction === GDesktopEnums.PadButtonAction.HELP ||
+ selectedAction === GDesktopEnums.PadButtonAction.SWITCH_MONITOR)
this._buttonItems.push(item);
}
}
_updateKeybindingEntryState() {
- if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING) {
+ if (this._currentAction === GDesktopEnums.PadButtonAction.KEYBINDING) {
this._keybindingEdit.set_text(this._currentKeybinding);
this._keybindingEdit.show();
this._keybindingEdit.grab_key_focus();
let keybinding = null;
- if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING)
+ if (this._currentAction === GDesktopEnums.PadButtonAction.KEYBINDING)
keybinding = this._currentKeybinding;
this._buttonSettings.set_enum('action', this._currentAction);
x = x * this._scale + this._actorWidth / 2 - dimensions.width / 2 * this._scale;
y = y * this._scale + this._actorHeight / 2 - dimensions.height / 2 * this._scale;
- if (direction == LTR) {
+ if (direction === LTR) {
childBox.x1 = x;
childBox.x2 = x + natWidth;
} else {
deactivateButton(button) {
for (let i = 0; i < this._activeButtons.length; i++) {
- if (this._activeButtons[i] == button)
+ if (this._activeButtons[i] === button)
this._activeButtons.splice(i, 1);
}
this._invalidateSvg();
return;
for (let i = 0; i < this._labels.length; i++) {
- if (action == this._labels[i].action &&
- idx == this._labels[i].idx && dir == this._labels[i].dir) {
+ if (action === this._labels[i].action &&
+ idx === this._labels[i].idx && dir === this._labels[i].dir) {
this._curEdited = this._labels[i];
editedLabel = this._curEdited.label;
break;
}, this);
seat.list_devices().forEach(device => {
- if (device != this.padDevice &&
- device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
+ if (device !== this.padDevice &&
+ device.get_device_type() === Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device))
this._groupPads.push(device);
});
}
_requestForOtherPad(pad) {
- if (pad == this.padDevice || !this._groupPads.includes(pad))
+ if (pad === this.padDevice || !this._groupPads.includes(pad))
return;
let editionMode = this._editionMode;
vfunc_captured_event(event) {
let isModeSwitch =
- (event.type() == Clutter.EventType.PAD_BUTTON_PRESS ||
- event.type() == Clutter.EventType.PAD_BUTTON_RELEASE) &&
+ (event.type() === Clutter.EventType.PAD_BUTTON_PRESS ||
+ event.type() === Clutter.EventType.PAD_BUTTON_RELEASE) &&
this.padDevice.get_mode_switch_button_group(event.get_button()) >= 0;
- if (event.type() == Clutter.EventType.PAD_BUTTON_PRESS &&
- event.get_source_device() == this.padDevice) {
+ if (event.type() === Clutter.EventType.PAD_BUTTON_PRESS &&
+ event.get_source_device() === this.padDevice) {
this._padDiagram.activateButton(event.get_button());
/* Buttons that switch between modes cannot be edited */
if (this._editionMode && !isModeSwitch)
this._startButtonActionEdition(event.get_button());
return Clutter.EVENT_STOP;
- } else if (event.type() == Clutter.EventType.PAD_BUTTON_RELEASE &&
- event.get_source_device() == this.padDevice) {
+ } else if (event.type() === Clutter.EventType.PAD_BUTTON_RELEASE &&
+ event.get_source_device() === this.padDevice) {
this._padDiagram.deactivateButton(event.get_button());
if (isModeSwitch) {
this._updateActionLabels();
}
return Clutter.EVENT_STOP;
- } else if (event.type() == Clutter.EventType.KEY_PRESS &&
+ } else if (event.type() === Clutter.EventType.KEY_PRESS &&
(!this._editionMode || event.get_key_symbol() === Clutter.KEY_Escape)) {
if (this._editedAction != null)
this._endActionEdition();
else
this.destroy();
return Clutter.EVENT_STOP;
- } else if (event.get_source_device() == this.padDevice &&
- event.type() == Clutter.EventType.PAD_STRIP) {
+ } else if (event.get_source_device() === this.padDevice &&
+ event.type() === Clutter.EventType.PAD_STRIP) {
if (this._editionMode) {
let [retval_, number, mode] = event.get_pad_event_details();
this._startStripActionEdition(number, Meta.PadDirection.UP, mode);
}
- } else if (event.get_source_device() == this.padDevice &&
- event.type() == Clutter.EventType.PAD_RING) {
+ } else if (event.get_source_device() === this.padDevice &&
+ event.type() === Clutter.EventType.PAD_RING) {
if (this._editionMode) {
let [retval_, number, mode] = event.get_pad_event_details();
this._startRingActionEdition(number, Meta.PadDirection.CCW, mode);
if (!this._editedAction)
return false;
- return this._editedAction.type == type &&
- this._editedAction.number == number &&
- this._editedAction.dir == dir;
+ return this._editedAction.type === type &&
+ this._editedAction.number === number &&
+ this._editedAction.dir === dir;
}
_endActionEdition() {
}
setEditionMode(editionMode) {
- if (this._editionMode == editionMode)
+ if (this._editionMode === editionMode)
return;
this._editionMode = editionMode;
let padDevice = null;
devices.forEach(device => {
- if (deviceNode == device.get_device_node() &&
- device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
+ if (deviceNode === device.get_device_node() &&
+ device.get_device_type() === Clutter.InputDeviceType.PAD_DEVICE)
padDevice = device;
});
Signals: {'page-activated': {param_types: [GObject.TYPE_INT]}},
}, class PageIndicators extends St.BoxLayout {
_init(orientation = Clutter.Orientation.VERTICAL) {
- let vertical = orientation == Clutter.Orientation.VERTICAL;
+ let vertical = orientation === Clutter.Orientation.VERTICAL;
super._init({
style_class: 'page-indicators',
vertical,
}
setNPages(nPages) {
- if (this._nPages == nPages)
+ if (this._nPages === nPages)
return;
let diff = nPages - this._nPages;
this._iconBox.connect('style-changed', () => {
let themeNode = this._iconBox.get_theme_node();
- iconEffect.enabled = themeNode.get_icon_style() == St.IconStyle.SYMBOLIC;
+ iconEffect.enabled = themeNode.get_icon_style() === St.IconStyle.SYMBOLIC;
});
this._label = new St.Label({
_onAppStateChanged(appSys, app) {
let state = app.state;
- if (state != Shell.AppState.STARTING)
- this._startingApps = this._startingApps.filter(a => a != app);
- else if (state == Shell.AppState.STARTING)
+ if (state !== Shell.AppState.STARTING)
+ this._startingApps = this._startingApps.filter(a => a !== app);
+ else if (state === Shell.AppState.STARTING)
this._startingApps.push(app);
// For now just resync on all running state changes; this is mainly to handle
// cases where the focused window's application changes without the focus
_sync() {
let targetApp = this._findTargetApp();
- if (this._targetApp != targetApp) {
+ if (this._targetApp !== targetApp) {
this._targetApp?.disconnectObject(this);
this._targetApp = targetApp;
this.fadeOut();
let isBusy = this._targetApp != null &&
- (this._targetApp.get_state() == Shell.AppState.STARTING ||
+ (this._targetApp.get_state() === Shell.AppState.STARTING ||
this._targetApp.get_busy());
if (isBusy)
this.startAnimation();
}
handleDragOver(source, _actor, _x, _y, _time) {
- if (source != Main.xdndHandler)
+ if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
- if (this._xdndTimeOut != 0)
+ if (this._xdndTimeOut !== 0)
GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview();
}
vfunc_event(event) {
- if (event.type() == Clutter.EventType.TOUCH_END ||
- event.type() == Clutter.EventType.BUTTON_RELEASE) {
+ if (event.type() === Clutter.EventType.TOUCH_END ||
+ event.type() === Clutter.EventType.BUTTON_RELEASE) {
if (Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
}
vfunc_key_release_event(event) {
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
+ if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_space) {
if (Main.overview.shouldToggleByCornerOrButton()) {
Main.overview.toggle();
return Clutter.EVENT_STOP;
let [x, y] = global.get_pointer();
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
- if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
+ if (pickedActor === this && Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
GLib.source_remove(this._xdndTimeOut);
childBox.y1 = 0;
childBox.y2 = allocHeight;
- if (this.get_text_direction() == Clutter.TextDirection.RTL) {
+ if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = Math.max(
allocWidth - Math.min(Math.floor(sideWidth), leftNaturalWidth),
0);
childBox.y1 = 0;
childBox.y2 = allocHeight;
- if (this.get_text_direction() == Clutter.TextDirection.RTL) {
+ if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = 0;
childBox.x2 = Math.min(Math.floor(sideWidth), rightNaturalWidth);
} else {
vfunc_key_press_event(event) {
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Escape) {
+ if (symbol === Clutter.KEY_Escape) {
global.display.focus_default_window(event.get_time());
return Clutter.EVENT_STOP;
}
else if (this._rightBox.contains(indicator.container))
boxAlignment = Clutter.ActorAlign.END;
- if (boxAlignment == Main.messageTray.bannerAlignment)
+ if (boxAlignment === Main.messageTray.bannerAlignment)
Main.messageTray.bannerBlocked = isOpen;
});
}
let rect = metaWindow.get_frame_rect();
return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() &&
- metaWindow.get_window_type() != Meta.WindowType.DESKTOP &&
+ metaWindow.get_window_type() !== Meta.WindowType.DESKTOP &&
metaWindow.maximized_vertically &&
stageX > rect.x && stageX < rect.x + rect.width;
});
vfunc_event(event) {
if (this.menu &&
- (event.type() == Clutter.EventType.TOUCH_BEGIN ||
- event.type() == Clutter.EventType.BUTTON_PRESS))
+ (event.type() === Clutter.EventType.TOUCH_BEGIN ||
+ event.type() === Clutter.EventType.BUTTON_PRESS))
this.menu.toggle();
return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_STOP;
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
+ if (symbol === Clutter.KEY_Left || symbol === Clutter.KEY_Right) {
let group = global.focus_manager.get_group(this);
if (group) {
- let direction = symbol == Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
+ let direction = symbol === Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
group.navigate_focus(this, direction, false);
return Clutter.EVENT_STOP;
}
}
set angle(angle) {
- if (this._angle == angle)
+ if (this._angle === angle)
return;
this._angle = angle;
this._pieTimer.start(x, y, timeout);
- if (type == Clutter.PointerA11yTimeoutType.GESTURE)
+ if (type === Clutter.PointerA11yTimeoutType.GESTURE)
global.display.set_cursor(Meta.Cursor.CROSSHAIR);
});
if (!clicked)
this._pieTimer.destroy();
- if (type == Clutter.PointerA11yTimeoutType.GESTURE)
+ if (type === Clutter.PointerA11yTimeoutType.GESTURE)
global.display.set_cursor(Meta.Cursor.DEFAULT);
});
}
_removeWatch(watch) {
for (let i = 0; i < this._watches.length; i++) {
- if (this._watches[i] == watch) {
+ if (this._watches[i] === watch) {
this._watches.splice(i, 1);
this._updateTimeout();
return;
this._timeoutId = 0;
}
- if (this._idle || this._watches.length == 0)
+ if (this._idle || this._watches.length === 0)
return;
let minInterval = this._watches[0].interval;
_updatePointer() {
let [x, y] = global.get_pointer();
- if (this.pointerX == x && this.pointerY == y)
+ if (this.pointerX === x && this.pointerY === y)
return;
this.pointerX = x;
for (let i = 0; i < this._watches.length;) {
let watch = this._watches[i];
watch.callback(x, y);
- if (watch == this._watches[i]) // guard against self-removal
+ if (watch === this._watches[i]) // guard against self-removal
i++;
}
}
return Clutter.EVENT_PROPAGATE;
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
+ if (symbol === Clutter.KEY_space || symbol === Clutter.KEY_Return) {
this.activate(event);
return Clutter.EVENT_STOP;
}
}
set active(active) {
- let activeChanged = active != this.active;
+ let activeChanged = active !== this.active;
if (activeChanged) {
this._active = active;
if (active) {
}
setSensitive(sensitive) {
- if (this._sensitive == sensitive)
+ if (this._sensitive === sensitive)
return;
this._sensitive = sensitive;
this._ornament = ornament;
- if (ornament == Ornament.DOT) {
+ if (ornament === Ornament.DOT) {
this._ornamentIcon.icon_name = 'ornament-dot-symbolic';
this.add_accessible_state(Atk.StateType.CHECKED);
- } else if (ornament == Ornament.CHECK) {
+ } else if (ornament === Ornament.CHECK) {
this._ornamentIcon.icon_name = 'ornament-check-symbolic';
this.add_accessible_state(Atk.StateType.CHECKED);
- } else if (ornament == Ornament.NONE || ornament == Ornament.HIDDEN) {
+ } else if (ornament === Ornament.NONE || ornament === Ornament.HIDDEN) {
this._ornamentIcon.icon_name = '';
this.remove_accessible_state(Atk.StateType.CHECKED);
}
}
_syncVisibility() {
- this.label.visible = this.label.text != '';
+ this.label.visible = this.label.text !== '';
}
});
// we allow pressing space to toggle the switch
// without closing the menu
- if (event.type() == Clutter.EventType.KEY_PRESS &&
- event.get_key_symbol() == Clutter.KEY_space)
+ if (event.type() === Clutter.EventType.KEY_PRESS &&
+ event.get_key_symbol() === Clutter.KEY_space)
return;
super.activate(event);
addAction(title, callback, icon) {
let menuItem;
- if (icon != undefined)
+ if (icon !== undefined)
menuItem = new PopupImageMenuItem(title, icon);
else
menuItem = new PopupMenuItem(title);
}
itemActivated(animate) {
- if (animate == undefined)
+ if (animate === undefined)
animate = BoxPointer.PopupAnimation.FULL;
this._getTopMenu().close(animate);
}
_subMenuActiveChanged(submenu, submenuItem) {
- if (this._activeMenuItem && this._activeMenuItem != submenuItem)
+ if (this._activeMenuItem && this._activeMenuItem !== submenuItem)
this._activeMenuItem.active = false;
this._activeMenuItem = submenuItem;
this.emit('active-changed', submenuItem);
let i = 0;
while (i < items.length && position > 0) {
- if (items[i] != menuItem)
+ if (items[i] !== menuItem)
position--;
i++;
}
if (i < items.length) {
- if (items[i] != menuItem)
+ if (items[i] !== menuItem)
this.box.set_child_below_sibling(menuItem.actor, items[i].actor);
} else {
this.box.set_child_above_sibling(menuItem.actor, null);
addMenuItem(menuItem, position) {
let beforeItem = null;
- if (position == undefined) {
+ if (position === undefined) {
this.box.add(menuItem.actor);
} else {
let items = this._getMenuItems();
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
+ if (symbol === Clutter.KEY_space || symbol === Clutter.KEY_Return) {
this.toggle();
return Clutter.EVENT_STOP;
- } else if (symbol == navKey) {
+ } else if (symbol === navKey) {
if (!this.isOpen)
this.toggle();
this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
if (animate && needsScrollbar)
animate = false;
- let targetAngle = this.actor.text_direction == Clutter.TextDirection.RTL ? -90 : 90;
+ let targetAngle = this.actor.text_direction === Clutter.TextDirection.RTL ? -90 : 90;
if (animate) {
let [, naturalHeight] = this.actor.get_preferred_height(-1);
_onKeyPressEvent(actor, event) {
// Move focus back to parent menu if the user types Left.
- if (this.isOpen && event.get_key_symbol() == Clutter.KEY_Left) {
+ if (this.isOpen && event.get_key_symbol() === Clutter.KEY_Left) {
this.close(BoxPointer.PopupAnimation.FULL);
this.sourceActor._delegate.active = true;
return Clutter.EVENT_STOP;
vfunc_key_press_event(event) {
let symbol = event.get_key_symbol();
- if (symbol == Clutter.KEY_Right) {
+ if (symbol === Clutter.KEY_Right) {
this._setOpenState(true);
this.menu.actor.navigate_focus(null, St.DirectionType.DOWN, false);
return Clutter.EVENT_STOP;
- } else if (symbol == Clutter.KEY_Left && this._getOpenState()) {
+ } else if (symbol === Clutter.KEY_Left && this._getOpenState()) {
this._setOpenState(false);
return Clutter.EVENT_STOP;
}
menu.actor.connectObject('captured-event',
this._onCapturedEvent.bind(this), this);
- if (position == undefined)
+ if (position === undefined)
this._menus.push(menu);
else
this._menus.splice(position, 0, menu);
}
const position = this._menus.indexOf(menu);
- if (position == -1) // not a menu we manage
+ if (position === -1) // not a menu we manage
return;
menu.disconnectObject(this);
idxB = sortOrder.indexOf(appIdB);
// if no provider is found in the order, use alphabetical order
- if ((idxA == -1) && (idxB == -1)) {
+ if ((idxA === -1) && (idxB === -1)) {
let nameA = providerA.appInfo.get_name();
let nameB = providerB.appInfo.get_name();
}
// if providerA isn't found, it's sorted after providerB
- if (idxA == -1)
+ if (idxA === -1)
return 1;
// if providerB isn't found, it's sorted after providerA
- if (idxB == -1)
+ if (idxB === -1)
return -1;
// finally, if both providers are found, return their order in the list
if (symbol === Clutter.KEY_Tab) {
let text = o.get_text();
let prefix;
- if (text.lastIndexOf(' ') == -1)
+ if (text.lastIndexOf(' ') === -1)
prefix = text;
else
prefix = text.substr(text.lastIndexOf(' ') + 1);
let k = 0;
for (; k < s1.length && k < s2.length; k++) {
- if (s1[k] != s2[k])
+ if (s1[k] !== s2[k])
break;
}
- if (k == 0)
+ if (k === 0)
return '';
return s1.substr(0, k);
}
let info;
while ((info = fileEnum.next_file(null))) {
let name = info.get_name();
- if (name.slice(0, text.length) == text)
+ if (name.slice(0, text.length) === text)
results.push(name);
}
} catch (e) {
} catch (e) {
// Mmmh, that failed - see if @input matches an existing file
let path = null;
- if (input.charAt(0) == '/') {
+ if (input.charAt(0) === '/') {
path = input;
} else if (input) {
- if (input.charAt(0) == '~')
+ if (input.charAt(0) === '~')
input = input.slice(1);
path = `${GLib.get_home_dir()}/${input}`;
}
let prevIsActive = this._isActive;
this._isActive = active;
- if (prevIsActive != this._isActive)
+ if (prevIsActive !== this._isActive)
this.emit('active-changed');
this._syncInhibitor();
}
_onStatusChanged(status) {
- if (status != GnomeSession.PresenceStatus.IDLE)
+ if (status !== GnomeSession.PresenceStatus.IDLE)
return;
this._maybeCancelDialog();
return;
}
- if (this._activationTime == 0)
+ if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time();
let shouldLock = this._settings.get_boolean(LOCK_ENABLED_KEY) && !this._isLocked;
Main.uiGroup.set_child_above_sibling(lightbox, null);
lightbox.lightOn(time);
- if (this._becameActiveId == 0)
+ if (this._becameActiveId === 0)
this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this));
}
}
_hideLockScreen(animate) {
- if (this._lockScreenState == MessageTray.State.HIDDEN)
+ if (this._lockScreenState === MessageTray.State.HIDDEN)
return;
this._lockScreenState = MessageTray.State.HIDING;
// This prevents the shield going down if the lock-delay timeout
// fires while the user is dragging (which has the potential
// to confuse our state)
- if (this._lockScreenState != MessageTray.State.HIDDEN)
+ if (this._lockScreenState !== MessageTray.State.HIDDEN)
return;
this._lockScreenGroup.show();
_continueDeactivate(animate) {
this._hideLockScreen(animate);
- if (Main.sessionMode.currentMode == 'unlock-dialog')
+ if (Main.sessionMode.currentMode === 'unlock-dialog')
Main.sessionMode.popMode('unlock-dialog');
this.emit('wake-up-screen');
this.actor.hide();
- if (this._becameActiveId != 0) {
+ if (this._becameActiveId !== 0) {
this.idleMonitor.remove_watch(this._becameActiveId);
this._becameActiveId = 0;
}
- if (this._lockTimeoutId != 0) {
+ if (this._lockTimeoutId !== 0) {
GLib.source_remove(this._lockTimeoutId);
this._lockTimeoutId = 0;
}
}
activate(animate) {
- if (this._activationTime == 0)
+ if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time();
if (!this._ensureUnlockDialog(true))
}
_createStream(filename, invocation) {
- if (filename == '')
+ if (filename === '')
return [Gio.MemoryOutputStream.new_resizable(), null];
if (GLib.path_is_absolute(filename)) {
}
vfunc_motion_event(event) {
- if (this._startX == -1 || this._startY == -1 || this._result)
+ if (this._startX === -1 || this._startY === -1 || this._result)
return Clutter.EVENT_PROPAGATE;
[this._lastX, this._lastY] = event.get_coords();
Shell.write_string_to_stream(out, ',\n"monitors":\n[');
for (let i = 0; i < monitors.length; i++) {
let monitor = monitors[i];
- if (i != 0)
+ if (i !== 0)
Shell.write_string_to_stream(out, ', ');
const prefix = i === primary ? '*' : '';
Shell.write_string_to_stream(out,
}
_keyFocusIn(actor) {
- if (this._focusChild == actor)
+ if (this._focusChild === actor)
return;
this._focusChild = actor;
this.notify('focus-child');
async updateSearch(providerResults, terms, callback) {
this._terms = terms;
- if (providerResults.length == 0) {
+ if (providerResults.length === 0) {
this._clearResultDisplay();
this.hide();
callback();
_getMaxDisplayedResults() {
let width = this.allocation.get_width();
- if (width == 0)
+ if (width === 0)
return -1;
return this._grid.layout_manager.columnsForWidth(width);
// search while the previous search is still active.
let searchString = terms.join(' ');
let previousSearchString = this._terms.join(' ');
- if (searchString == previousSearchString)
+ if (searchString === previousSearchString)
return;
this._startingSearch = true;
this._cancellable.cancel();
this._cancellable.reset();
- if (terms.length == 0) {
+ if (terms.length === 0) {
this._reset();
return;
}
let isSubSearch = false;
if (this._terms.length > 0)
- isSubSearch = searchString.indexOf(previousSearchString) == 0;
+ isSubSearch = searchString.indexOf(previousSearchString) === 0;
this._terms = terms;
this._isSubSearch = isSubSearch;
this._updateSearchProgress();
- if (this._searchTimeoutId == 0)
+ if (this._searchTimeoutId === 0)
this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this));
this._highlighter = new Highlighter(this._terms);
}
}
- if (newDefaultResult != this._defaultResult) {
+ if (newDefaultResult !== this._defaultResult) {
this._setSelected(this._defaultResult, false);
this._setSelected(newDefaultResult, this._highlightDefault);
}
navigateFocus(direction) {
- let rtl = this.get_text_direction() == Clutter.TextDirection.RTL;
- if (direction == St.DirectionType.TAB_BACKWARD ||
- direction == (rtl
+ let rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
+ if (direction === St.DirectionType.TAB_BACKWARD ||
+ direction === (rtl
? St.DirectionType.RIGHT
: St.DirectionType.LEFT) ||
- direction == St.DirectionType.UP) {
+ direction === St.DirectionType.UP) {
this.navigate_focus(null, direction, false);
return;
}
animateLaunch() {
let appSys = Shell.AppSystem.get_default();
let app = appSys.lookup_app(this.provider.appInfo.get_id());
- if (app.state == Shell.AppState.STOPPED)
+ if (app.state === Shell.AppState.STOPPED)
IconGrid.zoomOutActor(this._content);
}
function _loadMode(file, info) {
let name = info.get_name();
let suffix = name.indexOf('.json');
- let modeName = suffix == -1 ? name : name.slice(name, suffix);
+ let modeName = suffix === -1 ? name : name.slice(name, suffix);
if (Object.prototype.hasOwnProperty.call(_modes, modeName))
return;
}
popMode(mode) {
- if (this.currentMode != mode || this._modeStack.length === 1)
+ if (this.currentMode !== mode || this._modeStack.length === 1)
throw new Error('Invalid SessionMode.popMode');
console.debug(`sessionMode: Popping mode ${mode}`);
}
switchMode(to) {
- if (this.currentMode == to)
+ if (this.currentMode === to)
return;
this._modeStack[this._modeStack.length - 1] = to;
this._sync();
try {
returnValue = JSON.stringify(eval(code));
// A hack; DBus doesn't have null/undefined
- if (returnValue == undefined)
+ if (returnValue === undefined)
returnValue = '';
success = true;
} catch (e) {
_grabAcceleratorForSender(accelerator, modeFlags, grabFlags, sender) {
let bindingAction = global.display.grab_accelerator(accelerator, grabFlags);
- if (bindingAction == Meta.KeyBindingAction.NONE)
+ if (bindingAction === Meta.KeyBindingAction.NONE)
return Meta.KeyBindingAction.NONE;
let bindingName = Meta.external_binding_name_for_action(bindingAction);
_ungrabAcceleratorForSender(action, sender) {
let grabbedBy = this._grabbedAccelerators.get(action);
- if (sender != grabbedBy)
+ if (sender !== grabbedBy)
return false;
return this._ungrabAccelerator(action);
_onGrabberBusNameVanished(connection, name) {
let grabs = this._grabbedAccelerators.entries();
for (let [action, sender] of grabs) {
- if (sender == name)
+ if (sender === name)
this._ungrabAccelerator(action);
}
Gio.bus_unwatch_name(this._grabbers.get(name));
_updateCopyItem() {
let selection = this._entry.clutter_text.get_selection();
this._copyItem.setSensitive(!this._entry.clutter_text.password_char &&
- selection && selection != '');
+ selection && selection !== '');
}
_updatePasteItem() {
this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
(clipboard, text) => {
- this._pasteItem.setSensitive(text && text != '');
+ this._pasteItem.setSensitive(text && text !== '');
});
}
if (entry.menu.isOpen) {
entry.menu.close(BoxPointer.PopupAnimation.FULL);
return Clutter.EVENT_STOP;
- } else if (event.get_button() == 3) {
+ } else if (event.get_button() === 3) {
let [stageX] = event.get_coords();
_setMenuAlignment(entry, stageX);
entry.menu.open(BoxPointer.PopupAnimation.FULL);
this._dialog.connectObject('response',
(object, choice, password, remember, hiddenVolume, systemVolume, pim) => {
- if (choice == -1) {
+ if (choice === -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else {
if (remember)
this._processesDialog.connectObject('response',
(object, choice) => {
- if (choice == -1) {
+ if (choice === -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else {
this.mountOp.set_choice(choice);
if (!this._notifier)
this._notifier = new ShellUnmountNotifier();
- if (bytesLeft == 0)
+ if (bytesLeft === 0)
this._notifier.done(message);
else
this._notifier.show(message);
this._currentId = requestId;
this._currentType = type;
- if (this._dialog && (oldId == requestId) && (oldType == type))
+ if (this._dialog && (oldId === requestId) && (oldType === type))
return true;
return false;
let details = {};
let response;
- if (choice == -1) {
+ if (choice === -1) {
response = Gio.MountOperationResult.ABORTED;
} else {
response = Gio.MountOperationResult.HANDLED;
let response;
let details = {};
- if (choice == -1) {
+ if (choice === -1) {
response = Gio.MountOperationResult.ABORTED;
} else {
response = Gio.MountOperationResult.HANDLED;
let response;
let details = {};
- if (choice == -1) {
+ if (choice === -1) {
response = Gio.MountOperationResult.ABORTED;
} else {
response = Gio.MountOperationResult.HANDLED;
let sequence = event.get_event_sequence();
if (!this._dragging &&
- event.type() == Clutter.EventType.TOUCH_BEGIN) {
+ event.type() === Clutter.EventType.TOUCH_BEGIN) {
this.startDragging(event);
return Clutter.EVENT_STOP;
} else if (this._grabbedSequence &&
sequence.get_slot() === this._grabbedSequence.get_slot()) {
- if (event.type() == Clutter.EventType.TOUCH_UPDATE)
+ if (event.type() === Clutter.EventType.TOUCH_UPDATE)
return this._motionEvent(this, event);
- else if (event.type() == Clutter.EventType.TOUCH_END)
+ else if (event.type() === Clutter.EventType.TOUCH_END)
return this._endDragging();
}
if (event.get_flags() & Clutter.EventFlags.POINTER_EMULATED)
return Clutter.EVENT_PROPAGATE;
- if (direction == Clutter.ScrollDirection.DOWN) {
+ if (direction === Clutter.ScrollDirection.DOWN) {
delta = -SLIDER_SCROLL_STEP;
- } else if (direction == Clutter.ScrollDirection.UP) {
+ } else if (direction === Clutter.ScrollDirection.UP) {
delta = SLIDER_SCROLL_STEP;
- } else if (direction == Clutter.ScrollDirection.SMOOTH) {
+ } else if (direction === Clutter.ScrollDirection.SMOOTH) {
let [, dy] = event.get_scroll_delta();
// Even though the slider is horizontal, use dy to match
// the UP/DOWN above.
vfunc_key_press_event(event) {
let key = event.get_key_symbol();
- if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
- let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;
+ if (key === Clutter.KEY_Right || key === Clutter.KEY_Left) {
+ let delta = key === Clutter.KEY_Right ? 0.1 : -0.1;
this.value = Math.max(0, Math.min(this._value + delta, this._maxValue));
return Clutter.EVENT_STOP;
}
_syncMenuVisibility() {
this.visible =
this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
- this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW;
+ this._a11ySettings.get_string(KEY_DWELL_MODE) === DWELL_MODE_WINDOW;
return GLib.SOURCE_REMOVE;
}
_updateClickType(manager, clickType) {
for (let mode in DWELL_CLICK_MODES) {
- if (DWELL_CLICK_MODES[mode].type == clickType)
+ if (DWELL_CLICK_MODES[mode].type === clickType)
this._icon.icon_name = DWELL_CLICK_MODES[mode].icon;
}
}
}
_keyPressHandler(keysym, action) {
- if (action == this._action)
+ if (action === this._action)
this._select(this._next());
- else if (action == this._actionBackward)
+ else if (action === this._actionBackward)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Left)
+ else if (keysym === Clutter.KEY_Left)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Right)
+ else if (keysym === Clutter.KEY_Right)
this._select(this._next());
else
return Clutter.EVENT_PROPAGATE;
}
_ibusReadyCallback(im, ready) {
- if (this._ibusReady == ready)
+ if (this._ibusReady === ready)
return;
this._ibusReady = ready;
_modifiersSwitcher() {
let sourceIndexes = Object.keys(this._inputSources);
- if (sourceIndexes.length == 0) {
+ if (sourceIndexes.length === 0) {
KeyboardManager.releaseKeyboard();
return true;
}
this.emit('current-source-changed', oldSource);
for (let i = 1; i < this._mruSources.length; ++i) {
- if (this._mruSources[i] == newSource) {
+ if (this._mruSources[i] === newSource) {
let currentSource = this._mruSources.splice(i, 1);
this._mruSources = currentSource.concat(this._mruSources);
break;
// work without restarting when/if the user adds an IBus input
// source.
let engine;
- if (is.type == INPUT_SOURCE_TYPE_IBUS)
+ if (is.type === INPUT_SOURCE_TYPE_IBUS)
engine = is.id;
else
engine = 'xkb:us::eng';
}
// Initialize from settings when we have no MRU sources list
- if (this._mruSources.length == 0) {
+ if (this._mruSources.length === 0) {
let mruSettings = this._settings.mruSources;
for (let i = 0; i < mruSettings.length; i++) {
let mruSettingSource = mruSettings[i];
for (let j = 0; j < sourcesList.length; j++) {
let source = sourcesList[j];
- if (source.type == mruSettingSource.type &&
- source.id == mruSettingSource.id) {
+ if (source.type === mruSettingSource.type &&
+ source.id === mruSettingSource.id) {
mruSource = source;
break;
}
let id = sources[i].id;
let exists = false;
- if (type == INPUT_SOURCE_TYPE_XKB) {
+ if (type === INPUT_SOURCE_TYPE_XKB) {
[exists, displayName, shortName] =
this._xkbInfo.get_layout_info(id);
- } else if (type == INPUT_SOURCE_TYPE_IBUS) {
+ } else if (type === INPUT_SOURCE_TYPE_IBUS) {
if (this._disableIBus)
continue;
let engineDesc = this._ibusManager.getEngineDesc(id);
let language = IBus.get_language_name(engineDesc.get_language());
let longName = engineDesc.get_longname();
let textdomain = engineDesc.get_textdomain();
- if (textdomain != '')
+ if (textdomain !== '')
longName = Gettext.dgettext(textdomain, longName);
exists = true;
displayName = `${language} (${longName})`;
infosList.push({type, id, displayName, shortName});
}
- if (infosList.length == 0) {
+ if (infosList.length === 0) {
let type = INPUT_SOURCE_TYPE_XKB;
let id = KeyboardManager.DEFAULT_LAYOUT;
let [, displayName, shortName] = this._xkbInfo.get_layout_info(id);
this._inputSources[is.index] = is;
- if (is.type == INPUT_SOURCE_TYPE_IBUS)
+ if (is.type === INPUT_SOURCE_TYPE_IBUS)
this._ibusSources[is.id] = is;
}
return symbol;
let langCode = engineDesc.get_language().split('_', 1)[0];
- if (langCode.length == 2 || langCode.length == 3)
+ if (langCode.length === 2 || langCode.length === 3)
return langCode.toLowerCase();
return String.fromCharCode(0x2328); // keyboard glyph
source.properties = props;
- if (source == this._currentSource)
+ if (source === this._currentSource)
this.emit('current-source-changed', null);
}
return;
if (this._updateSubProperty(source.properties, prop) &&
- source == this._currentSource)
+ source === this._currentSource)
this.emit('current-source-changed', null);
}
let p;
for (let i = 0; (p = props.get(i)) != null; ++i) {
- if (p.get_key() == prop.get_key() && p.get_prop_type() == prop.get_prop_type()) {
+ if (p.get_key() === prop.get_key() && p.get_prop_type() === prop.get_prop_type()) {
p.update(prop);
return true;
- } else if (p.get_prop_type() == IBus.PropType.MENU) {
+ } else if (p.get_prop_type() === IBus.PropType.MENU) {
if (this._updateSubProperty(p.get_sub_props(), prop))
return true;
}
// the focus change caused by the switcher popup causing this purpose change.
if (this._switcherPopup)
return;
- if (purpose == IBus.InputPurpose.PASSWORD) {
- if (Object.keys(this._inputSources).length == Object.keys(this._ibusSources).length)
+ if (purpose === IBus.InputPurpose.PASSWORD) {
+ if (Object.keys(this._inputSources).length === Object.keys(this._ibusSources).length)
return;
if (this._disableIBus)
_getNewInputSource(current) {
let sourceIndexes = Object.keys(this._inputSources);
- if (sourceIndexes.length == 0)
+ if (sourceIndexes.length === 0)
return null;
if (current) {
for (let i in this._inputSources) {
let is = this._inputSources[i];
- if (is.type == current.type &&
- is.id == current.id)
+ if (is.type === current.type &&
+ is.id === current.id)
return is;
}
}
_sourcesPerWindowChanged() {
this._sourcesPerWindow = this._settings.perWindow;
- if (this._sourcesPerWindow && this._focusWindowNotifyId == 0) {
+ if (this._sourcesPerWindow && this._focusWindowNotifyId === 0) {
this._focusWindowNotifyId = global.display.connect('notify::focus-window',
this._setPerWindowInputSource.bind(this));
Main.overview.connectObject(
'showing', this._setPerWindowInputSource.bind(this),
'hidden', this._setPerWindowInputSource.bind(this), this);
- } else if (!this._sourcesPerWindow && this._focusWindowNotifyId != 0) {
+ } else if (!this._sourcesPerWindow && this._focusWindowNotifyId !== 0) {
global.display.disconnect(this._focusWindowNotifyId);
this._focusWindowNotifyId = 0;
Main.overview.disconnectObject(this);
if (!prop.get_visible())
continue;
- if (prop.get_key() == 'InputMode') {
+ if (prop.get_key() === 'InputMode') {
let text;
if (prop.get_symbol)
text = prop.get_symbol().get_text();
item.prop = prop;
radioGroup.push(item);
item.radioGroup = radioGroup;
- item.setOrnament(prop.get_state() == IBus.PropState.CHECKED
+ item.setOrnament(prop.get_state() === IBus.PropState.CHECKED
? PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
item.connect('activate', () => {
- if (item.prop.get_state() == IBus.PropState.CHECKED)
+ if (item.prop.get_state() === IBus.PropState.CHECKED)
return;
let group = item.radioGroup;
for (let j = 0; j < group.length; ++j) {
- if (group[j] == item) {
+ if (group[j] === item) {
item.setOrnament(PopupMenu.Ornament.DOT);
item.prop.set_state(IBus.PropState.CHECKED);
ibusManager.activateProperty(
break;
case IBus.PropType.TOGGLE:
- item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED);
+ item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() === IBus.PropState.CHECKED);
item.prop = prop;
item.connect('toggled', () => {
if (item.state) {
let xkbLayout = '';
let xkbVariant = '';
- if (source.type == INPUT_SOURCE_TYPE_XKB) {
+ if (source.type === INPUT_SOURCE_TYPE_XKB) {
[, , , xkbLayout, xkbVariant] = KeyboardManager.getXkbInfo().get_layout_info(source.id);
- } else if (source.type == INPUT_SOURCE_TYPE_IBUS) {
+ } else if (source.type === INPUT_SOURCE_TYPE_IBUS) {
let engineDesc = IBusManager.getIBusManager().getEngineDesc(source.id);
if (engineDesc) {
xkbLayout = engineDesc.get_layout();
}
}
- if (!xkbLayout || xkbLayout.length == 0)
+ if (!xkbLayout || xkbLayout.length === 0)
return;
let description = xkbLayout;
function accuracyLevelToString(accuracyLevel) {
for (let key in GeoclueAccuracyLevel) {
- if (GeoclueAccuracyLevel[key] == accuracyLevel)
+ if (GeoclueAccuracyLevel[key] === accuracyLevel)
return key;
}
}
_completeAuth() {
- if (this._accuracyLevel != GeoclueAccuracyLevel.NONE) {
+ if (this._accuracyLevel !== GeoclueAccuracyLevel.NONE) {
this._accuracyLevel = Math.clamp(this._accuracyLevel,
0, this._maxAccuracyLevel);
}
this._mobileDevice = null;
let capabilities = device.current_capabilities;
- if (device.udi.indexOf('/org/freedesktop/ModemManager1/Modem') == 0)
+ if (device.udi.indexOf('/org/freedesktop/ModemManager1/Modem') === 0)
this._mobileDevice = new ModemManager.BroadbandModem(device.udi, capabilities);
else if (capabilities & NM.DeviceModemCapabilities.GSM_UMTS)
this._mobileDevice = new ModemManager.ModemGsm(device.udi);
async _portalHelperDone(parameters) {
let [path, result] = parameters;
- if (result == PortalHelperResult.CANCELLED) {
+ if (result === PortalHelperResult.CANCELLED) {
// Keep the connection in the queue, so the user is not
// spammed with more logins until we next flush the queue,
// which will happen once they choose a better connection
// or we get to full connectivity through other means
- } else if (result == PortalHelperResult.COMPLETED) {
+ } else if (result === PortalHelperResult.COMPLETED) {
this._closeConnectivityCheck(path);
- } else if (result == PortalHelperResult.RECHECK) {
+ } else if (result === PortalHelperResult.RECHECK) {
try {
const state = await this._client.check_connectivity_async(null);
if (state >= NM.ConnectivityState.FULL)
async _syncConnectivity() {
if (this._mainConnection == null ||
- this._mainConnection.state != NM.ActiveConnectionState.ACTIVATED) {
+ this._mainConnection.state !== NM.ActiveConnectionState.ACTIVATED) {
this._flushConnectivityQueue();
return;
}
- let isPortal = this._client.connectivity == NM.ConnectivityState.PORTAL;
+ let isPortal = this._client.connectivity === NM.ConnectivityState.PORTAL;
// For testing, allow interpreting any value != FULL as PORTAL, because
// LIMITED (no upstream route after the default gateway) is easy to obtain
// with a tethered phone
_findHeadphones(sink) {
// This only works for external headphones (e.g. bluetooth)
- if (sink.get_form_factor() == 'headset' ||
- sink.get_form_factor() == 'headphone')
+ if (sink.get_form_factor() === 'headset' ||
+ sink.get_form_factor() === 'headphone')
return true;
// a bit hackish, but ALSA/PulseAudio have a number
}
_keyPressHandler(keysym, action) {
- if (action == Meta.KeyBindingAction.SWITCH_MONITOR)
+ if (action === Meta.KeyBindingAction.SWITCH_MONITOR)
this._select(this._next());
- else if (keysym == Clutter.KEY_Left)
+ else if (keysym === Clutter.KEY_Left)
this._select(this._previous());
- else if (keysym == Clutter.KEY_Right)
+ else if (keysym === Clutter.KEY_Right)
this._select(this._next());
else
return Clutter.EVENT_PROPAGATE;
}
function primaryModifier(mask) {
- if (mask == 0)
+ if (mask === 0)
return 0;
let primary = 1;
_initialSelection(backward, _binding) {
if (backward)
this._select(this._items.length - 1);
- else if (this._items.length == 1)
+ else if (this._items.length === 1)
this._select(0);
else
this._select(1);
}
show(backward, binding, mask) {
- if (this._items.length == 0)
+ if (this._items.length === 0)
return false;
let grab = Main.pushModal(this);
this._disableHover();
- if (this._keyPressHandler(keysym, action) != Clutter.EVENT_PROPAGATE) {
+ if (this._keyPressHandler(keysym, action) !== Clutter.EVENT_PROPAGATE) {
this._showImmediately();
return Clutter.EVENT_STOP;
}
let [x_, y_, mods] = global.get_pointer();
let state = mods & this._modifierMask;
- if (state == 0)
+ if (state === 0)
this._finish(event.get_time());
} else {
this._resetNoModsTimeout();
}
_scrollHandler(direction) {
- if (direction == Clutter.ScrollDirection.UP)
+ if (direction === Clutter.ScrollDirection.UP)
this._select(this._previous());
- else if (direction == Clutter.ScrollDirection.DOWN)
+ else if (direction === Clutter.ScrollDirection.DOWN)
this._select(this._next());
}
_disableHover() {
this.mouseActive = false;
- if (this._motionTimeoutId != 0)
+ if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId);
this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
}
_resetNoModsTimeout() {
- if (this._noModsTimeoutId != 0)
+ if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = GLib.timeout_add(
_onDestroy() {
this._popModal();
- if (this._motionTimeoutId != 0)
+ if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId);
- if (this._initialDelayTimeoutId != 0)
+ if (this._initialDelayTimeoutId !== 0)
GLib.source_remove(this._initialDelayTimeoutId);
- if (this._noModsTimeoutId != 0)
+ if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId);
// Make sure the SwitcherList is always destroyed, it may not be
_onReset(authPrompt, beginRequest) {
let userName;
- if (beginRequest == AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
+ if (beginRequest === AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
this._authPrompt.setUser(this._user);
userName = this._userName;
} else {
// If user is null, that implies a username-based login authorization.
this._user = user;
- let vertical = orientation == Clutter.Orientation.VERTICAL;
+ let vertical = orientation === Clutter.Orientation.VERTICAL;
let xAlign = vertical ? Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START;
let styleClass = vertical ? 'user-widget vertical' : 'user-widget horizontal';
_tick() {
this._countDown--;
- if (this._countDown == 0) {
+ if (this._countDown === 0) {
/* mutter already takes care of failing at timeout */
this._timeoutId = 0;
this.close();
for (i = 0; i < this._workspaces.length; i++) {
let lastRemoved = this._workspaces[i]._lastRemovedWindow;
if ((lastRemoved &&
- (lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
- lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
- lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG)) ||
+ (lastRemoved.get_window_type() === Meta.WindowType.SPLASHSCREEN ||
+ lastRemoved.get_window_type() === Meta.WindowType.DIALOG ||
+ lastRemoved.get_window_type() === Meta.WindowType.MODAL_DIALOG)) ||
this._workspaces[i]._keepAliveId)
emptyWorkspaces[i] = false;
else
for (i = lastIndex; i >= 0; i--) {
if (workspaceManager.n_workspaces === MIN_NUM_WORKSPACES)
break;
- if (emptyWorkspaces[i] && i != lastEmptyIndex)
+ if (emptyWorkspaces[i] && i !== lastEmptyIndex)
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
}
workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces();
let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => {
- if (workspace._lastRemovedWindow == window) {
+ if (workspace._lastRemovedWindow === window) {
workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces();
}
_windowLeftMonitor(metaDisplay, monitorIndex, _metaWin) {
// If the window left the primary monitor, that
// might make that workspace empty
- if (monitorIndex == Main.layoutManager.primaryIndex)
+ if (monitorIndex === Main.layoutManager.primaryIndex)
this._queueCheckWorkspaces();
}
let oldNumWorkspaces = this._workspaces.length;
let newNumWorkspaces = workspaceManager.n_workspaces;
- if (oldNumWorkspaces == newNumWorkspaces)
+ if (oldNumWorkspaces === newNumWorkspaces)
return false;
if (newNumWorkspaces > oldNumWorkspaces) {
let removedNum = oldNumWorkspaces - newNumWorkspaces;
for (let w = 0; w < oldNumWorkspaces; w++) {
let workspace = workspaceManager.get_workspace_by_index(w);
- if (this._workspaces[w] != workspace) {
+ if (this._workspaces[w] !== workspace) {
removedIndex = w;
break;
}
if (this._rect && this._rect.equal(tileRect))
return;
- let changeMonitor = this._monitorIndex == -1 ||
- this._monitorIndex != monitorIndex;
+ let changeMonitor = this._monitorIndex === -1 ||
+ this._monitorIndex !== monitorIndex;
this._monitorIndex = monitorIndex;
this._rect = tileRect;
_updateStyle(monitor) {
let styles = ['tile-preview'];
- if (this._monitorIndex == Main.layoutManager.primaryIndex)
+ if (this._monitorIndex === Main.layoutManager.primaryIndex)
styles.push('on-primary');
- if (this._rect.x == monitor.x)
+ if (this._rect.x === monitor.x)
styles.push('tile-preview-left');
- if (this._rect.x + this._rect.width == monitor.x + monitor.width)
+ if (this._rect.x + this._rect.width === monitor.x + monitor.width)
styles.push('tile-preview-right');
this.style_class = styles.join(' ');
}
vfunc_gesture_prepare(_actor) {
- if (Main.actionMode != Shell.ActionMode.NORMAL) {
+ if (Main.actionMode !== Shell.ActionMode.NORMAL) {
this.cancel();
return false;
}
let nPoints = this.get_n_current_points();
let event = this.get_last_event(nPoints - 1);
- if (nPoints == 3) {
+ if (nPoints === 3) {
this._longPressStartTime = event.get_time();
- } else if (nPoints == 4) {
+ } else if (nPoints === 4) {
// Check whether the 4th finger press happens after a 3-finger long press,
// this only needs to be checked on the first 4th finger press
if (this._longPressStartTime != null &&
}
vfunc_gesture_progress(_actor) {
- if (this.get_n_current_points() == 3) {
+ if (this.get_n_current_points() === 3) {
for (let i = 0; i < this.get_n_current_points(); i++) {
let [startX, startY] = this.get_press_coords(i);
let [x, y] = this.get_motion_coords(i);
_lookupIndex(windows, metaWindow) {
for (let i = 0; i < windows.length; i++) {
- if (windows[i].metaWindow == metaWindow)
+ if (windows[i].metaWindow === metaWindow)
return i;
}
return -1;
win.located_on_workspace(activeWorkspace);
});
- if (windows.length == 0)
+ if (windows.length === 0)
return;
let focusWindow = global.display.focus_window;
addKeybinding(name, settings, flags, modes, handler) {
let action = global.display.add_keybinding(name, settings, flags, handler);
- if (action != Meta.KeyBindingAction.NONE)
+ if (action !== Meta.KeyBindingAction.NONE)
this.allowKeybinding(name, modes);
return action;
}
}
xDest = monitor.x;
yDest = monitor.y;
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
xDest += monitor.width;
xScale = 0;
yScale = 0;
return;
}
actor.set_position(monitor.x, monitor.y);
- if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
+ if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
actor.x += monitor.width;
actor.set_scale(0, 0);
}
} else if (!shouldDim && window._dimmed) {
window._dimmed = false;
this._dimmedWindows =
- this._dimmedWindows.filter(win => win != window);
+ this._dimmedWindows.filter(win => win !== window);
this._undimWindow(window);
}
}
window.disconnectObject(actor);
if (window._dimmed) {
this._dimmedWindows =
- this._dimmedWindows.filter(win => win != window);
+ this._dimmedWindows.filter(win => win !== window);
}
if (window.is_attached_dialog())
}
_filterKeybinding(shellwm, binding) {
- if (Main.actionMode == Shell.ActionMode.NONE)
+ if (Main.actionMode === Shell.ActionMode.NONE)
return true;
// There's little sense in implementing a keybinding in mutter and
// not having it work in NORMAL mode; handle this case generically
// so we don't have to explicitly allow all builtin keybindings in
// NORMAL mode.
- if (Main.actionMode == Shell.ActionMode.NORMAL &&
+ if (Main.actionMode === Shell.ActionMode.NORMAL &&
binding.is_builtin())
return false;
if (!Main.sessionMode.hasWorkspaces)
return;
- if (workspaceManager.n_workspaces == 1)
+ if (workspaceManager.n_workspaces === 1)
return;
let [action,,, target] = binding.get_name().split('-');
let newWs;
let direction;
- let vertical = workspaceManager.layout_rows == -1;
- let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
+ let vertical = workspaceManager.layout_rows === -1;
+ let rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
- if (action == 'move') {
+ if (action === 'move') {
// "Moving" a window to another workspace doesn't make sense when
// it cannot be unstuck, and is potentially confusing if a new
// workspaces is added at the start/end
if (window.is_always_on_all_workspaces() ||
(Meta.prefs_get_workspaces_only_on_primary() &&
- window.get_monitor() != Main.layoutManager.primaryIndex))
+ window.get_monitor() !== Main.layoutManager.primaryIndex))
return;
}
- if (target == 'last') {
+ if (target === 'last') {
if (vertical)
direction = Meta.MotionDirection.DOWN;
else if (rtl)
}
}
- if (workspaceManager.layout_rows == -1 &&
- direction != Meta.MotionDirection.UP &&
- direction != Meta.MotionDirection.DOWN)
+ if (workspaceManager.layout_rows === -1 &&
+ direction !== Meta.MotionDirection.UP &&
+ direction !== Meta.MotionDirection.DOWN)
return;
- if (workspaceManager.layout_columns == -1 &&
- direction != Meta.MotionDirection.LEFT &&
- direction != Meta.MotionDirection.RIGHT)
+ if (workspaceManager.layout_columns === -1 &&
+ direction !== Meta.MotionDirection.LEFT &&
+ direction !== Meta.MotionDirection.RIGHT)
return;
- if (action == 'switch')
+ if (action === 'switch')
this.actionMoveWorkspace(newWs);
else
this.actionMoveWindow(window, newWs);
if (!window.allows_resize())
item.setSensitive(false);
- if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) {
+ if (!window.titlebar_is_onscreen() && type !== Meta.WindowType.DOCK && type !== Meta.WindowType.DESKTOP) {
this.addAction(_('Move Titlebar Onscreen'), () => {
window.shove_titlebar_onscreen();
});
});
if (window.is_above())
item.setOrnament(PopupMenu.Ornament.CHECK);
- if (window.get_maximized() == Meta.MaximizeFlags.BOTH ||
- type == Meta.WindowType.DOCK ||
- type == Meta.WindowType.DESKTOP ||
- type == Meta.WindowType.SPLASHSCREEN)
+ if (window.get_maximized() === Meta.MaximizeFlags.BOTH ||
+ type === Meta.WindowType.DOCK ||
+ type === Meta.WindowType.DESKTOP ||
+ type === Meta.WindowType.SPLASHSCREEN)
item.setSensitive(false);
if (Main.sessionMode.hasWorkspaces &&
if (!isSticky) {
let workspace = window.get_workspace();
- if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
+ if (workspace !== workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
this.addAction(_('Move to Workspace Left'), () => {
let dir = Meta.MotionDirection.LEFT;
window.change_workspace(workspace.get_neighbor(dir));
});
}
- if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
+ if (workspace !== workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
this.addAction(_('Move to Workspace Right'), () => {
let dir = Meta.MotionDirection.RIGHT;
window.change_workspace(workspace.get_neighbor(dir));
});
}
- if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) {
+ if (workspace !== workspace.get_neighbor(Meta.MotionDirection.UP)) {
this.addAction(_('Move to Workspace Up'), () => {
let dir = Meta.MotionDirection.UP;
window.change_workspace(workspace.get_neighbor(dir));
});
}
- if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
+ if (workspace !== workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
this.addAction(_('Move to Workspace Down'), () => {
let dir = Meta.MotionDirection.DOWN;
window.change_workspace(workspace.get_neighbor(dir));
let dir = Meta.DisplayDirection.UP;
let upMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
- if (upMonitorIndex != -1) {
+ if (upMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Up'), () => {
window.move_to_monitor(upMonitorIndex);
});
dir = Meta.DisplayDirection.DOWN;
let downMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
- if (downMonitorIndex != -1) {
+ if (downMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Down'), () => {
window.move_to_monitor(downMonitorIndex);
});
dir = Meta.DisplayDirection.LEFT;
let leftMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
- if (leftMonitorIndex != -1) {
+ if (leftMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Left'), () => {
window.move_to_monitor(leftMonitorIndex);
});
dir = Meta.DisplayDirection.RIGHT;
let rightMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
- if (rightMonitorIndex != -1) {
+ if (rightMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Right'), () => {
window.move_to_monitor(rightMonitorIndex);
});
if (!Main.sessionMode.hasWmMenus)
return;
- if (type != Meta.WindowMenuType.WM)
+ if (type !== Meta.WindowMenuType.WM)
throw new Error('Unsupported window menu type');
let menu = new WindowMenu(window, this._sourceActor);
parent = parent.get_transient_for();
// Display dialog if it is attached to our metaWindow
- if (win.is_attached_dialog() && parent == this.metaWindow)
+ if (win.is_attached_dialog() && parent === this.metaWindow)
this._addWindow(win);
// The dialog popped up after the user tried to close the window,
vfunc_key_press_event(event) {
let symbol = event.get_key_symbol();
- let isEnter = symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter;
+ let isEnter = symbol === Clutter.KEY_Return || symbol === Clutter.KEY_KP_Enter;
if (isEnter) {
this._activate();
return true;
this.monitorIndex = monitorIndex;
this._monitor = Main.layoutManager.monitors[this.monitorIndex];
- if (monitorIndex != Main.layoutManager.primaryIndex)
+ if (monitorIndex !== Main.layoutManager.primaryIndex)
this.add_style_class_name('external-monitor');
const clickAction = new Clutter.ClickAction();
}
_lookupIndex(metaWindow) {
- return this._windows.findIndex(w => w.metaWindow == metaWindow);
+ return this._windows.findIndex(w => w.metaWindow === metaWindow);
}
containsMetaWindow(metaWindow) {
}
isEmpty() {
- return this._windows.length == 0;
+ return this._windows.length === 0;
}
syncStacking(stackIndices) {
// the compositor finds out about them...
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (metaWin.get_compositor_private() &&
- metaWin.get_workspace() == this.metaWorkspace)
+ metaWin.get_workspace() === this.metaWorkspace)
this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE;
});
// We might have the window in our list already if it was on all workspaces and
// now was moved to this workspace
- if (this._lookupIndex(metaWin) != -1)
+ if (this._lookupIndex(metaWin) !== -1)
return;
if (!this._isMyWindow(metaWin))
// Let the top-most ancestor handle all transients
let parent = metaWin.find_root_ancestor();
- let clone = this._windows.find(c => c.metaWindow == parent);
+ let clone = this._windows.find(c => c.metaWindow === parent);
// If no clone was found, the parent hasn't been created yet
// and will take care of the dialog when added
}
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
- if (monitorIndex == this.monitorIndex)
+ if (monitorIndex === this.monitorIndex)
this._doRemoveWindow(metaWin);
}
this._container.layout_manager.addWindow(clone, metaWindow);
- if (this._windows.length == 0)
+ if (this._windows.length === 0)
clone.setStackAbove(null);
else
clone.setStackAbove(this._windows[this._windows.length - 1]);
// find the position of the window in our list
let index = this._lookupIndex(metaWin);
- if (index == -1)
+ if (index === -1)
return null;
this._container.layout_manager.removeWindow(this._windows[index]);
this._activeWorkspaceIndex = activeWorkspaceIndex;
this._redisplay();
- if (this._timeoutId != 0)
+ if (this._timeoutId !== 0)
GLib.source_remove(this._timeoutId);
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISPLAY_TIMEOUT, this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
}
_lookupIndex(metaWindow) {
- return this._windows.findIndex(w => w.metaWindow == metaWindow);
+ return this._windows.findIndex(w => w.metaWindow === metaWindow);
}
syncStacking(stackIndices) {
}
set slidePosition(slidePosition) {
- if (this._slidePosition == slidePosition)
+ if (this._slidePosition === slidePosition)
return;
const scale = Util.lerp(1, 0.75, slidePosition);
}
set collapseFraction(collapseFraction) {
- if (this._collapseFraction == collapseFraction)
+ if (this._collapseFraction === collapseFraction)
return;
this._collapseFraction = collapseFraction;
this.notify('collapse-fraction');
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (!this._removed &&
metaWin.get_compositor_private() &&
- metaWin.get_workspace() == this.metaWorkspace)
+ metaWin.get_workspace() === this.metaWorkspace)
this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE;
});
// We might have the window in our list already if it was on all workspaces and
// now was moved to this workspace
- if (this._lookupIndex(metaWin) != -1)
+ if (this._lookupIndex(metaWin) !== -1)
return;
if (!this._isMyWindow(win))
_windowRemoved(metaWorkspace, metaWin) {
let index = this._allWindows.indexOf(metaWin);
- if (index != -1) {
+ if (index !== -1) {
metaWin.disconnectObject(this);
this._allWindows.splice(index, 1);
}
}
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
- if (monitorIndex == this.monitorIndex)
+ if (monitorIndex === this.monitorIndex)
this._doAddWindow(metaWin);
}
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
- if (monitorIndex == this.monitorIndex)
+ if (monitorIndex === this.monitorIndex)
this._doRemoveWindow(metaWin);
}
_isMyWindow(actor) {
let win = actor.meta_window;
return win.located_on_workspace(this.metaWorkspace) &&
- (win.get_monitor() == this.monitorIndex);
+ (win.get_monitor() === this.monitorIndex);
}
// Tests if @win should be shown in the Overview
// find the position of the window in our list
let index = this._lookupIndex(metaWin);
- if (index == -1)
+ if (index === -1)
return null;
return this._windows.splice(index, 1).pop();
// Draggable target interface used only by ThumbnailsBox
handleDragOverInternal(source, actor, time) {
- if (source == Main.xdndHandler) {
+ if (source === Main.xdndHandler) {
this.metaWorkspace.activate(time);
return DND.DragMotionResult.CONTINUE;
}
}
_clearDragPlaceholder() {
- if (this._dropPlaceholderPos == -1)
+ if (this._dropPlaceholderPos === -1)
return;
this._dropPlaceholderPos = -1;
if (!source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch) &&
- source != Main.xdndHandler)
+ source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
}
}
- if (this._dropPlaceholderPos != placeholderPos) {
+ if (this._dropPlaceholderPos !== placeholderPos) {
this._dropPlaceholderPos = placeholderPos;
this.queue_relayout();
}
- if (this._dropWorkspace != -1)
+ if (this._dropWorkspace !== -1)
return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, actor, time);
- else if (this._dropPlaceholderPos != -1)
+ else if (this._dropPlaceholderPos !== -1)
return source.metaWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP;
else
return DND.DragMotionResult.CONTINUE;
}
acceptDrop(source, actor, x, y, time) {
- if (this._dropWorkspace != -1) {
+ if (this._dropWorkspace !== -1) {
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time);
- } else if (this._dropPlaceholderPos != -1) {
+ } else if (this._dropPlaceholderPos !== -1) {
if (!source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch))
}
_destroyThumbnails() {
- if (this._thumbnails.length == 0)
+ if (this._thumbnails.length === 0)
return;
this._transientSignalHolder.destroy();
let removedNum = oldNumWorkspaces - newNumWorkspaces;
for (let w = 0; w < oldNumWorkspaces; w++) {
let metaWorkspace = workspaceManager.get_workspace_by_index(w);
- if (this._thumbnails[w].metaWorkspace != metaWorkspace) {
+ if (this._thumbnails[w].metaWorkspace !== metaWorkspace) {
removedIndex = w;
break;
}
}
set scale(scale) {
- if (this._scale == scale)
+ if (this._scale === scale)
return;
this._scale = scale;
}
_iterateStateThumbnails(state, callback) {
- if (this._stateCounts[state] == 0)
+ if (this._stateCounts[state] === 0)
return;
for (let i = 0; i < this._thumbnails.length; i++) {
- if (this._thumbnails[i].state == state)
+ if (this._thumbnails[i].state === state)
callback.call(this, this._thumbnails[i]);
}
}
vfunc_allocate(box) {
this.set_allocation(box);
- let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
+ let rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
- if (this._thumbnails.length == 0) // not visible
+ if (this._thumbnails.length === 0) // not visible
return;
let themeNode = this.get_theme_node();
let x = box.x1;
- if (this._dropPlaceholderPos == -1) {
+ if (this._dropPlaceholderPos === -1) {
this._dropPlaceholder.allocate_preferred_size(
...this._dropPlaceholder.get_position());
} else {
workspace = this._workspaces[j];
- if (workspace.metaWorkspace != metaWorkspace) { /* removed */
+ if (workspace.metaWorkspace !== metaWorkspace) { /* removed */
workspace.destroy();
this._workspaces.splice(j, 1);
} /* else kept */
return Clutter.EVENT_PROPAGATE;
if (this._workspacesOnlyOnPrimary &&
- this._getMonitorIndexForEvent(event) != this._primaryIndex)
+ this._getMonitorIndexForEvent(event) !== this._primaryIndex)
return Clutter.EVENT_PROPAGATE;
return Main.wm.handleWorkspaceScroll(event);
let motionFunc = DND.dragMonitors[i].dragMotion;
if (motionFunc) {
let result = motionFunc(dragEvent);
- if (result != DND.DragMotionResult.CONTINUE)
+ if (result !== DND.DragMotionResult.CONTINUE)
return;
}
}
targX,
targY,
global.get_current_time());
- if (result != DND.DragMotionResult.CONTINUE)
+ if (result !== DND.DragMotionResult.CONTINUE)
return;
}
pickedActor = pickedActor.get_parent();
rules:
- eqeqeq: off
jsdoc/check-alignment: off
jsdoc/check-param-names: off
jsdoc/check-tag-names: off